Document directory
Time limit for a bee: 1000 ms memory limit: 10000 k total time limit: 3000 Ms
Description:
A trained bee can only crawl to the adjacent beehive on the right, and cannot reverse crawl. Calculate the number of possible routes for bees to climb from Master A to Master B.
The structure of the beehive is as follows.
Input:
Each row contains two integers, A and B (0 <A <B <= 50 ).
Output:
For the given test instance, please output the number of possible routes for the bee to climb from the master a to the Master B, and the output occupies a row.
Input example:
1 2
3 6
Output example:
1
3
Tip:
Recursive solution: the total number of routes from 3 to 6 equals the total number of routes from 3 to 5 plus the total number of routes from 3 to 4.
Source:
Code:
- # Include <stdio. h>
- Int main ()
- {
- Double num [55];
- Int I, A, B;
- Num [0] = 1;
- Num [1] = 1;
- For (I = 2; I <55; I ++)
- {
- Num [I] = num [I-1] + num [I-2];
- }
- Scanf ("% d", & A, & B );
- A = B-;
- Printf ("%. 0f \ n", num [a]);
- Return 0;
- }