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<stdio.h> #include<string.h> void main() { long a[100]; long i,j,s,s1,m; freopen("1.txt","r",stdin); scanf("%ld",&a[0]); j=0;i=0; while(a[0]) { j=1; s=0; while(j<=a[0]) { scanf("%ld",&a[j]); j++; } i=j; j=1; while(j<=a[0]) { s+=a[j]; j++; } j=1; s1=0; int flag=0; if(s%2==1) j=999999; while(j<=a[0]) { s1+=a[j]; j++; if(s1==s/2) { flag=1;m=j-1;break;} if(s1>s/2) break; } if(flag) printf("Sam stops at position %ld and Ella stops at position %ld.\n",m,m+1); else printf("No equal partitioning.\n"); scanf("%ld",&a[0]); } } 这个是麻烦了点,但是过了 ,你看看吧 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator