南阳76
1 //dp 2 #include<iostream> 3 using namespace std; 4 5 int dp[40] = {0,1,2}; 6 7 void init() 8 { 9 for(int i=3; i<40; ++i) 10 dp[i] = dp[i-1] + dp[i-2]; 11 } 12 13 int main() 14 { 15 init(); 16 int n,m; 17 cin >> n; 18 while(n--) 19 { 20 cin >> m; 21 cout << dp[m-1] << endl; 22 } 23 return 0; 24 }