Find ' N ' number of solutions with the given inequality equations | C ++ implementation of above approach ; Function to calculate all the solutions ; there is no solutions ; print first element as y - n + 1 ; print rest n - 1 elements as 1 ; Driver code ; initialize the number of elements and the value of x an y
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define ll  long long NEW_LINE void findsolution ( ll n , ll x , ll y ) { if ( ( y - n + 1 ) * ( y - n + 1 ) + n - 1 < x y < n ) { cout << " No ▁ solution " ; return ; } cout << y - n + 1 ; while ( n -- > 1 ) cout << endl << 1 ; } int main ( ) { ll n , x , y ; n = 5 , x = 15 , y = 15 ; findsolution ( n , x , y ) ; return 0 ; }