Find ' N ' number of solutions with the given inequality equations | java 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
import java . io . * ; class GFG { static void findsolution ( long n , long x , long y ) { if ( ( y - n + 1 ) * ( y - n + 1 ) + n - 1 < x y < n ) { System . out . println ( " No ▁ solution " ) ; return ; } System . out . println ( y - n + 1 ) ; while ( n -- > 1 ) System . out . println ( "1" ) ; } public static void main ( String [ ] args ) { long n , x , y ; n = 5 ; x = 15 ; y = 15 ; findsolution ( n , x , y ) ; } }