hdu2044

/*
  Description:
  HDU__ACM  2044   一只小蜜蜂...
 
http://acm.hdu.edu.cn/showproblem.php?pid=2044
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>

using namespace std;

long long save[55];

long long Step(int a, int b)
{
   if(save[b])
     return save[b];
   if(a+1 == b)
     save[b] = 1;
   else if(a+2 == b)
     save[b] = 2;
   else save[b] =  Step(a,  b-1 ) + Step(a,  b-2 );
   return save[b];
}
int main()
{
  int iCase; scanf("%d", &iCase);
  int a, b;
  while(iCase-- ){
     memset(save, 0, sizeof(save));
     scanf("%d%d", &a, &b);
     cout<<Step(a, b)<<endl;//printf("%lf\n", Step(a, b));
  } 
  ////system("pause");
  return 0;
}

你可能感兴趣的:(C++,职场,include,iostream,休闲)