Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么总是RE

Posted by 00448322 at 2009-07-19 03:20:55 on Problem 1221
本机运行提前打表都没问题,一提交就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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator