Thursday, October 2, 2014

ACM 2001. Mathematicians and Berries / Математики и ягоды

Suppose the weight if the first basket is B1 and the weigh of the first man's berries is N. The same for the second one B2 and M. And we have input data a1,b1,a2,b2,a3,b3. If we write down all the equations it will be very clear and easy.

1.N+B1=a1
2.m+B2=b1
3.n+m+B1=a2
4.B2=b2
5.B1=a3
6.n+m+B2=b3
Throw away the 3rd and 6th equations. Out of the other ones we get that
N=a1-B1=a1-a2
and
M=b1-B2=b1-b2


       FULL SOURCE CODE


No comments:

Post a Comment