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 |
请高手指点迷津,为什么WA ,谢谢#include<iostream> using namespace std; int main() { int d; while(cin>>d&&d) { int *p=new int [d] ; int i,j; for(i=0;i<d;i++) cin>>p[i]; i=0;j=d-1;int s1=0,s2=0; while(i<=j) { if(s1>s2) s2+=p[j--]; else s1+=p[i++]; } if(s1!=s2) cout<<"No equal partitioning."<<endl; else cout<<"Sam stops at position "<<j+1<<" and Ella stops at position "<<i+1<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator