标签:
代码:
#include<iostream>
#include<string.h>
using namespace std;
int f[50];
int main(){
int m = 0;
int n = 0;
int i = 0;
cin >> m;
while(m--){
memset(f,0,sizeof(f));
cin >> n;
f[1] = 0;
f[2] = 1;
f[3] = 2;
if(n > 3){
for(i = 4;i <= n;i++){
f[i] = f[i-1] + f[i-2];
}
}
cout << f[n] << endl;
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/2016zhanggang/p/5479699.html