Banner Home Page DIY Contests Problems Ranklist Status Statistics
pdf版的题目下载:初赛goo.gl/rfbDY,决赛goo.gl/fNcyY。K题请使用GUN C++提交,用VC/VC++提交会返回RE。

Boys, get rid of singlehood!

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 390   Accepted Submission(s) : 163

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

Today is Single's Day. Tom hears there is an activity for single boys in FamilyMart. The rule
of this activity is that when the customer pays for the goods which he buys, if he can answer how
many different ways to pay the total money, he will be given a discount. But it is a hard problem
for Tom. Therefore, he asks you for help. Tom always thinks that you are clever enough to solve
this problem.
To simplify the problem, we assume there are only 3 nominal amounts of banknotes, 1 yuan,
2 yuan and 5 yuan.
Given an amount of N yuan, you are required to work out how many ways to pay with those
3 nominal amounts of banknotes mentioned above.

Input

The input file consists of several test cases.The first line of each test case contains an integer
N (1<= N <= 11111). Input is terminated by a value of zero (0) for n.

Output

Each test case prints one line made up of an integer which shows the number of the ways to pay.

Sample Input

5
6
7
0

Sample Output

4
5
6

Author

羊仔

Source

2012年华南师范大学校赛初赛

Statistic | Submit | Back