11679 - Sub-prime
Solution Description : Ad hoc problem This problem is very very easy. See the example bellow Input 3 3 1 1 1 1 2 1 2 3 2 3 1 3 For line: 1 1 1 Bank 1 = 1 Bank 2 = 1 Bank 3 = 1 i.e. Bank(i) = R(i) For line: 1 2 1 Bank 1 = 1 - 1 Bank 2 = 1 + 1 i.e. Bank(D) -= V and Bank(C) += V Fro line: 2 3 2 Bank 2 = 1 + 1 - 2 Bank 3 = 1 + 2 For line: 3 1 3 Bank 3 = 1 + 2 - 3 Bank 1 = 1 - 1 + 3 After that you get Bank 1 = 1 - 1 + 3 = 3 Bank 2 = 1 + 1 - 2 = 0 Bank 3 = 1 + 2 + 3 = 0 If all values are positive (i.e. >=0) then print "S" otherwise print "N" |
||||||||||