Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么总是RE本机运行提前打表都没问题,一提交就RE 请问为什么 #include<iostream> using namespace std; const int MAXSIZE=250; __int64 dp[MAXSIZE][MAXSIZE]; void caculate() { dp[1][1]=1; dp[2][1]=2; dp[2][2]=1; dp[3][1]=2; dp[3][2]=1; dp[3][3]=1; for(int i=4; i<=MAXSIZE; i++) { for(int j=i/2+1; j<=i; j++) dp[i][j]=1; if(i%2==0) dp[i][i/2]=2; else dp[i][i/2]=1; for(int j=i/2-1; j>=1; j--) { __int64 temp=0; if(i-2*j>0) temp=dp[i-2*j][j]; dp[i][j]=dp[i][j+1]+temp; } } } int main() { int n; caculate(); while(cin>>n) { if(n==0) break; printf("%d %I64d\n",n,dp[n][1]); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator