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 y07yangruilong at 2007-05-05 17:00:19 on Problem 1247
In Reply To:Re:求助!!!帮我看一下,麻烦大家了WA Posted by:ffff at 2005-05-09 23:29:46
我的代码:
#include<iostream.h>
void main()
{
	int n,input[30],sum;
	while(cin>>n)
	{
		if(n==0)break;
		sum=0;
		for(int i=0;i<n;i++)
		{
			cin>>input[i];
			sum+=input[i];
		}
		if(sum%2!=0)
		{
			cout<<"No equal partitioning."<<endl;
			continue;
		}
		sum/=2;
		for(i=0;i<n;i++)
		{
			sum-=input[i];
			if(sum<=0)break;
		}
		if(sum==0)cout<<"Sam stops at position "<<i+1<<" and Ella stops at position "<<i+2<<".\n";
		else cout<<"No equal partitioning."<<endl;
	}
}
不需要算两个人的,算一个就行了

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