2010 Canadian Computing Competition, Stage 1
Problem J1: What is n, Daddy?
Natalie is learning to count on her fingers. When her Daddy tells her a number n, she asks “What is n, Daddy?”, by which she means “How many fingers should I hold up on each hand so that the total is n?” To make matters simple, her Daddy gives her the correct finger representation according to the following rules:
- the number may be represented on one or two hands;
- if the number is represented on two hands, the larger number is given first.
For example, if Natalie asks “What is 4, Daddy?”, her Dad may reply:
- 4 is 4.
- 4 is 3 and 1.
- 4 is 2 and 2.
Your job is to make sure that Natalie’s Daddy gives the correct number of answers.
A single integer n (1 ≤ n ≤ 10).
The output is the number of ways of producing that number on two hands, subject to the rules outlined above.
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 23, 2010
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3