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 |
问一下,我这个错到哪里了呢?谢谢了!In Reply To:test Posted by:hawk at 2003-11-26 22:47:13 我的这个用你刚才的数据做是得10的 可是就是不能过啊 不知道为什么??? 帮忙看一下吧! #include<stdio.h> #include<malloc.h> void main(){ int *num,i,sum,n,max,a; scanf("%d",&n); if(n>64)return; while(n!=0){ sum=0;max=0; num=(int*)malloc((n+1)*sizeof(int)); for(i=1;i<=n;i++){ scanf("%d",&num[i]); if(num[i]>max) max=num[i]; sum=sum+num[i]; } for(a=max;a<=sum;a++){ if(sum%a==0) break; } printf("%d\n",a); free(num); scanf("%d",&n); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator