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 |
我不明白这个题目为什么要这么做#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