| ||||||||||
| 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 | |||||||||
运行没问题,提交怎么就是WRONG ANSWER?高人看下!#include "stdio.h"
main()
{ int N,i,sum,a[30],j,k;
float M;
do
{scanf("%d",&N);
for(i=0,sum=0;i<N;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(j=0,k=0,M=0;j<N;j++)
{
M=M+a[j];
if(M==(sum/2.0))
{
printf("Sam stops at position %d and Ella stops at position %d.\n",j+1,j+2);
break;
}
else
k++;
if(k==N-2)
printf("No equal partitioning.\n");
}
}
while(N!=0);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator