5、蜜蜂路线
【问题描述】
        一只蜜蜂在下图所示的数字蜂房上爬动,已知它只能从标号小的蜂房爬到标号大的相邻蜂房,现在问你:蜜蜂从蜂房M开始爬到蜂房N,M<N,有多少种爬行路线?
 蜜蜂路线
【输入格式】
 输入M,N的值。
【输出格式】
 爬行有多少种路线。
【输入样例】bee.in
   1  14
【输出样例】bee.out
   377
 
//include<AC自动机>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
int b[10001];
using namespace std;
int main()
{
    int n;
    int m;
    cin>>m>>n;int l=n-m;
    b[1]=1;
    b[2]=1;
    for(int i=3;i<=l+1;i++)
    {
        b[i]=b[i-1]+b[i-2];
    }
    cout<<b[l+1];
    return 0;
}

 

相关文章:

  • 2021-11-13
  • 2021-12-13
  • 2021-10-06
  • 2021-12-29
  • 2022-01-01
  • 2021-10-17
  • 2021-10-20
猜你喜欢
  • 2021-07-26
  • 2021-09-16
  • 2021-11-29
  • 2021-09-19
  • 2021-10-18
  • 2021-11-01
  • 2021-08-15
  • 2021-10-17
相关资源
相似解决方案