it's a task, on which i think during whole day.
i have four integer numbers
a, b, c, d,
and integer x[1,40]
.
i must write a program, which can find the values of {a,b,c,d}, for which one of following equations is true for any 1<=x<=40
x=a or
x=b or
x=a+b or
x=a+b+c+d or
x+a=c+d or
x+a+b=c+d or
...
x+a+b+c=d or ...
it is very difficult to explain what i want to say. maybe the example will be helpful.
example:
if x=17, by {a=1,b=2,c=5,d=15} i can write x+a+b=c+d
whole question is to present any
x[1,40] by {a,b,c,d}.
hope that you understand what i want to say, and thanks in advance
UPDATE:
and there is only one solution, i'm sure, and i think, that
{a=1;a+b+c+d=40}