| ||||||||||
| 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 | |||||||||
把你的post发到相应的题目下面,这样会方便后来者参考In Reply To:第1477题的源程序,大牛帮我看一下,怎么错了啊? Posted by:catoran at 2005-06-11 11:22:23 > #include<stdio.h>
> void main(){
> int a[1000],n,i,average,sum,mnum,count=0;
> while(1){
> scanf("%d",&n);
> if(n==0) return;
> else {
>
> count++;
> sum=0;
> for(i=0;i<n;i++){
> scanf("%d",&a[i]);
> sum+=a[i];
> }
> average=sum/n;
> mnum=0;
> for(i=0;i<n;i++){
> if(a[i]>average)
> mnum+=(a[i]-average);
> }
>
> if(count>1) printf("\n");
> printf("Set #%d\nThe minimum number of moves is %d.\n",count,mnum);
>
> }
> }
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator