Hive problem : there is a trained bees can only be climbed right adjacent hive, not the reverse crawl. Calculation program a number of possible routes to climb bee hive from hive b a.
Wherein the honeycomb structure shown below.
I intend to use at the start of the search method to search out the path and found very complex, and finally found the result was a series of similar Feibolaqi results.
#include<bits/stdc++.h>
#define check(x,y) (x<2&&x>=0&&y>=0&&y<30)
using namespace std;
int a[1000];
void solve(){
a[0]=0;
a[1]=1,a[2]=1;
for(int i=3;i<1000;i++){
a[i]=a[i-1]+a[i-2];
}
}
int main()
{
int n,m;
solve();
while(~scanf("%d %d",&n,&m)){
printf("%d\n",a[m-n+1]);
}
return 0;
}