ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1261. Tips

I don't under the meaning of this problem.Could somebody explain?
Posted by CNEinstein 17 Apr 2004 20:36
Re: I don't under the meaning of this problem.Could somebody explain?
Posted by Vesper 21 Apr 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.
Posted by CNEinstein 21 Apr 2004 21:34
Re: I don't under the meaning of this problem.Could somebody explain?
Posted by Edric Mao 25 Oct 2011 19:49
Thanks for the explanation.
Re: I don't under the meaning of this problem.Could somebody explain?
Posted by Ahmmed Jubayer Rumman 28 Jul 2020 19:57
here 4 can be represented as 1+3^1  . why i have to pay 13 ? I failed to understand the problem ?