No.1229 Rugby Scoring Patterns
Problem Statement
You are given a rugby team's score $N$.
Count the number of combinations of tries (T: $5$ points), conversions (G: $2$ points), and penalty goals (PG: $3$ points) that total $N$ points.
Note that since a conversion is a kick taken after a try, the number of conversions is always at most the number of tries.
Also, assume that there were no drop goals or penalty tries.
Input
$N$
- $N$ is an integer satisfying $0 \le N \le 100$.
Output
Output the number of patterns, followed by a newline.
Sample
Sample 1
Input
0
Output
1
When no points are scored, there is only $1$ pattern: $(T, G, PG) = (0, 0, 0)$.
Sample 2
Input
5
Output
1
The only way to total $5$ points is the $1$ pattern $(T, G, PG) = (1, 0, 0)$.
$(T, G, PG) = (0, 1, 1)$ is not valid because the number of conversions exceeds the number of tries.
Sample 3
Input
20
Output
4
There are $4$ patterns: $(T, G, PG) = \{(4, 0, 0), (3, 1, 1), (2, 2, 2), (1, 0, 5)\}$.
Sample 4
Input
100
Output
55
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
hotman78