Problem C
New Rule in Euphomia
Input: standard input
Output: standard output
Time
Limit: 1 second
The ancient country of Euphomia had some strange rules regarding payment of prices and values of coins. When King Albert ruled this country the following payment rules were in place:
a) The name of the currency was Abacus.
b) Only coins were used to pay any certain amount.
c) The coins had integer values. Eg. There is no coin with value 1.5 Abacus. And the amount to be paid was also always integer.
d) There was no 1 Abacus coin.
e) Payments of any amount had to be made with coins of the same value. For example when one paid 9 Abacus he paid it with three 3-Abacus coins.
So coins were made so that any one could pay any amount within 2-1000000 abacuses following the above rules. The coins, which were not required, were not made. For example there were no 6-Abacus coin because one could pay 6 Abacus as (3+3) Abacus. The problem with the above rule was that often one had to use many coins to pay a particular amounts. For example to pay the amount 2048 Abacus one had to use 1024 2-Abacus coins which is quite terrible. Therefore, when king Lucas captured this country he made unlimited coins of value 1 Abacus and added the following rule:
“One can only use exactly two different coins made during Albert's regime. In addition with these coins one can also use the 1-Abacus coins at any number. However one cannot use only the 1-Abacus coins to make payment."
So in this new rule paying 1 Abacus is still impossible but rule d) and e) of Albert’s regime is now obsolete. With this new rule in place your job is to find out in how many ways one could pay a certain amount n.
10 996542 24 129 0 |
Case
1: 5 Case
2: 1661327749 Case
3: 22 Case
4: 296 |
Problem
setter: Shahriar Manzoor, EPS
Special
thanks (for alternate solution): Derek Kisman, EPS