#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
int a,b,c,n;
vector<int> v;
vector<int>::iterator m1;
vector<int>::iterator m2;
while(scanf("%d", &n),n){
for(int i=0;i<n;i++){
scanf("%d", &a);
v.push_back(a);
}
m1=v.begin();m2=v.end()-1;
b=*m1;
c=*m2;
while(m1!=(m2-1)){
if(b<=c){
b+=*(++m1);
}else{
c+=*(--m2);
}
}
if(b==c)
printf("Sam stops at position %d and Ella stops at position %d.\n", m1-v.begin()+1, m2-v.begin()+1);
else printf("No equal partitioning.\n");
v.clear();
}
#ifndef ONLINE_JUDGE
fclose(stdin);
fclose(stdout);
#endif
}
poj 1247
最新推荐文章于 2016-01-08 22:07:51 发布