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:求助!!!帮我看一下,麻烦大家了WA

Posted by liuhaibin_11329 at 2006-09-29 20:10:24 on Problem 1247
In Reply To:求助!!!帮我看一下,麻烦大家了WA Posted by:ffff at 2005-05-09 23:27:16
> #include<iostream.h>
> 
> int main()
> {
> 	int N;
> 	int a[31]={0};
> 	int S=0;//clockwise
> 	int E=0;//counterclockwise
> 	int position1, position2;
> 	
> 	while(1)
> 	{//////////////////////
> 	cin>>N;
> 
> 	if(N==0)
> 		return 0;
> 	
> 	for(int i=1;i<=30;i++)
> 		a[i]=0;
> 	
> 	for(i=1;i<=N;i++)
> 		cin>>a[i];
> 
> 	position1=1;
> 	position2=N;
> 	
> 
> 	while(1)
> 	{//////////////////////////////////////////////////////
> 		if(S<=E)
> 		{
> 			S=a[position1]+S;
> 			position1++;
> 		}
> 		else
> 		{
> 			E=a[position2]+E;
> 			position2--;
> 		}
> 		if(S==E&&(position1-1)==position2)
> 		{
> 			cout<<"Sam stops at position "<<position1-1<<" and Ella stops at position "<<position2+1<<".";
> 			break;
> 		}
> 		if((position1-1)>position2)
> 		{
> 			cout<<"No equal partitioning.";
> 			break;
> 		}
> 
> 
> 	}///////////////////////////////////////////////////////
> 
> 
> 	}/////////////////////
> 	
> 
> 
> 	return 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