Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 57989 Accepted Submission(s): 29451
动态规划,简单题:
#include "iostream" #include "cstdio" using namespace std; int m[50]; void f() { m[1]=1; m[2]=2;m[3]=3; for(int i=4;i<50;i++) { m[i]=m[i-1]+m[i-2]; } } int main() { int t,n; f(); scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%d\n",m[n-1]); } }
原文:http://www.cnblogs.com/kimsimple/p/6701933.html