Find the value of a1, a2, a3, ….an such that the following two conditions are satisfied.
Print the value of a1, a2, …, an and “No solution” otherwise.
Note: There maybe a several solutions, print any of them .
Input: n = 5, x = 15, y = 15 Output: 11 1 1 1 1 Input: n = 4, x = 324, y = 77 Output: 74 1 1 1
Approach: Below is the step by step algorithm to solve this problem:
- Initialize the number of elements and the value of x and y.
- There is no solution of a1…a2 if y is less than n or if x is very larger than n.
- Print first solution as y – n + 1 and 1 as the solution of rest of the elements.
Below is the implementation of above approach:
11 1 1 1 1
- Number of solutions to Modular Equations
- Count Distinct Non-Negative Integer Pairs (x, y) that Satisfy the Inequality x*x + y*y < n
- Nesbitt's Inequality
- Find the values of X and Y in the Given Equations
- Find n positive integers that satisfy the given equations
- Find if two given Quadratic equations have common roots or not
- Find the repeating and the missing number using two equations
- Find the number of solutions to the given equation
- Program to find root of an equations using secant method
- Find n-variables from n sum equations with one missing
- Pair of integers (a, b) which satisfy the given equations
- Find number of solutions of a linear equation of n variables
- Program to find number of solutions in Quadratic Equation
- Count number of solutions of x^2 = 1 (mod p) in given range
- Gaussian Elimination to Solve Linear Equations
- Linear Diophantine Equations
- Using Chinese Remainder Theorem to Combine Modular equations
- System of Linear Equations in three variables using Cramer's Rule
- Data Science - Solving Linear Equations
- Data Science | Solving Linear Equations
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.