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

谁能帮我看看,为什么老是Presentation Error

Posted by C0400348073 at 2004-03-21 16:52:31 on Problem 1014
#include<iostream.h>
int value;
int array[169];
int temp[169];
void main()
{
	int a[6];
	int num=0;
	while(1)
	{
		value=0;
		for(int i=0;i<6;i++)
		{
			cin>>a[i];
		}
		num++;
		if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0)
			return;
		for(i=0;i<6;i++)
		{
			if(a[i]>8)
			{
				if(a[i]%2==0)
					a[i]=8;
				else
					a[i]=7;
			}
		}
		for(i=0;i<6;i++)
		{
			value+=a[i]*(i+1);
		}
		if(value%2!=0)
			cout<<"Collection #"<<num<<":\n"<<"Can't be divided.\n";
		else
		{
			array[0]=1;
			for(int j=0;j<6;j++)
			{
				while(a[j]>0)
				{
					for(int k=0;k<value+1;k++)
					{
						if(array[k]==1)
							temp[k]=1;
					}
					for(k=0;k<value+1;k++)
					{
						if(temp[k]==1)
							array[k+j+1]=1;
					}
					a[j]--;
				}
			}
			if(array[value/2])
				cout<<"Collection #"<<num<<":\n"<<"Can be divided. \n";

			else
				cout<<"Collection #"<<num<<":\n"<<"Can't be divided.\n";
			cout<<endl;
		for(i=0;i<value+1;i++)
		{
			array[i]=0;
		}
		for(i=0;i<value+1;i++)
		{
			temp[i]=0;
		}
		
		}
	}
}

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