What is n, Daddy?
InterviewTime limit2sMemory limit512 MB
Count the ordered pairs (a, b) with 1 <= b <= a <= 5 and possibly a single hand, summing to n.
- Level
Easy2 of 10
- Topics
- Math, Brute force, Implementation, Combinatorics
- Solved
- No attempts yet
Problem
Natalie is learning to count on her fingers. When her Daddy tells her a number (), she asks "What is , Daddy?", meaning "How many fingers should I hold up on each hand so that the total is ?"
Each hand can hold up at most 5 fingers. Her Daddy gives the correct finger representations according to the following rules:
- the number may be represented on one hand or on two hands;
- if the number is represented on two hands, each hand holds up at least one finger, and the larger number is given first.
For example, if Natalie asks "What is 4, Daddy?", her Daddy may reply:
- 4 is 4.
- 4 is 3 and 1.
- 4 is 2 and 2.
Your job is to count how many different answers Daddy can give.
Input
The input consists of a single integer with .
Output
Output the number of ways to represent with the fingers, following the rules above.