| ||||||||||
| 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:求助!!!帮我看一下,麻烦大家了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator