National Olympiad in Informatics, China, 2011
Farmer DongDong's crop yield has been sluggish all year long. Just when he's stressing over how to make some more money, he overheard the kids next door discussing the issue of rabbit breeding.
The question is this: A pair of little bunnies were just born at the
start of the first month. After growing up in two months, these rabbits
will give birth to two new little bunnies every month starting at the
start of the third month. The newborn bunnies, after two months of
growing up, will themselves give birth to a pair of bunnies every month
afterwards. So the kids ask, how many total pairs of rabbits will there
be in the
Being so clever, you've probably already discovered that the number of
pairs of rabbits in month
DongDong noticed that the further he goes, the faster the number of rabbits grow. Looking forward to making big bucks breeding rabbits, DongDong immediately went out and bought a pair of bunnies at the start of the first month.
Each day, DongDong will feed the rabbits. Rabbits are very particular
about their feeding habits. There will always be
Assuming that the rabbits who die are always the newest born, then the
number of rabbits can still be calculated. For instance, when
Given
Input Specification
A single line containing three positive integers
Output Specification
Output a single line containing a single integer, representing the
number of pairs of rabbits in month
Sample Input 1
6 7 100
Sample Output 1
7
Sample Input 2
7 7 5
Sample Output 2
2
Constraints
The attributes of all the test cases are outlined below.
Test Case | Range of | Range of |
---|---|---|
Problem translated to English by .
Comments