| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:求助!!!帮我看一下,麻烦大家了WAIn 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator