A little bee language: c

Source: Internet
Author: User
Document directory
  • A little bee
Time limit for a bee: 1000 ms memory limit: 10000 k total time limit: 3000 Ms


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.


Each row contains two integers, A and B (0 <A <B <= 50 ).


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:



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.




  1. # Include <stdio. h>
  2. Int main ()
  3. {
  4. Double num [55];
  5. Int I, A, B;
  6. Num [0] = 1;
  7. Num [1] = 1;
  8. For (I = 2; I <55; I ++)
  9. {
  10. Num [I] = num [I-1] + num [I-2];
  11. }
  12. Scanf ("% d", & A, & B );
  13. A = B-;
  14. Printf ("%. 0f \ n", num [a]);
  15. Return 0;
  16. }

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.