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> int main() { int n,m,i,j,k,l,q,w,e; int a[222]; e=0; while(scanf("%d",&n),n) { e++; if(e!=1) printf("\n"); int sum=0; for(i=1;i<=n;i++) scanf("%d",&a[i]),sum+=a[i]; m=sum/n; w=0; for(i=1;i<=n;i++) { if(a[i]>m) { w+=(a[i]-m); } } printf("Set #%d\n",e); printf("The minimum number of moves is "); printf("%d.\n",w); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator