标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 217 Accepted Submission(s): 160
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<string> #include<iostream> #include<cstring> #include<cmath> #include<stack> #include<queue> #include<vector> #include<map> #include<stdlib.h> #include<algorithm> #define LL __int64 using namespace std; const int MAXN=60+5; LL dp[MAXN][2],n; void init() { dp[1][0]=0;dp[1][1]=1; dp[2][0]=1;dp[2][1]=1; dp[3][0]=2;dp[3][1]=1; for(int i=4;i<=65;i++) { dp[i][0]=dp[i-1][0]+dp[i-1][1]; dp[i][1]=dp[i-3][0]+dp[i-3][1]+1; } } int main() { init(); //freopen("in.txt","r",stdin); while(scanf("%d",&n)!=EOF) { printf("%I64d\n",dp[n][0]+dp[n][1]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/clliff/p/4714809.html