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:为什么总是RE

Posted by onlyxuyang at 2010-07-15 20:53:47 on Problem 1221
In Reply To:为什么总是RE Posted by:00448322 at 2009-07-19 03:20:55
我觉得可能是那个MAX开小了,访问越界了吧
没说数不大于250吧
我做的时候还特地看了的
我后来拿不准 直接用的map<long long,map<long long ,long long > > ....

> 本机运行提前打表都没问题,一提交就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