|
|
вернуться в форумI don't under the meaning of this problem.Could somebody explain? Re: I don't under the meaning of this problem.Could somebody explain? Послано Vesper 21 апр 2004 17:46 A programmer has a set of banknotes valued 1, 3, 9 ..., 3^k,... one each. He has to pay N in a restaurant (provided) He must pay that much M so: M can be paid with banknotes the programmer has, i.e. he cannot pay 5, because he does not have 2 bank notes with value of 1; and M-N must be represented the same way, i.e. if N is 4, M cannot be 9, because 5 cannot be represented as a sum of 3^K, one or less for each K. So if asked 4, a programmer must pay 13, 13=9+3+1, 13-4=9. I hope you will understand this clumsy explanation. Thanks you for your help! I got AC. Re: I don't under the meaning of this problem.Could somebody explain? Thanks for the explanation. Re: I don't under the meaning of this problem.Could somebody explain? here 4 can be represented as 1+3^1 . why i have to pay 13 ? I failed to understand the problem ? |
|
|