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:那位大侠帮忙看一下,实在不知道为什么WA了?In Reply To:那位大侠帮忙看一下,实在不知道为什么WA了? Posted by:chengning at 2006-07-20 21:29:00 > #include<iostream.h> > int main() > { > int n,m,k,M[50],i,j; > m=k=j=0; > cin>>n; > while(n!=0) > { > for(i=0;i<n;i++) > { > cin>>M[i]; > m+=M[i]; > } > if(m%n==0) > { > for(i=0;i<n;i++) > { > if(M[i]>m/n) > { > k+=M[i]-m/n; > } > } > } > j++; > cout<<"Set #"<<j<<endl; > cout<<"The minimum number of moves is"<<' '<<k<<'.'<<endl; > cin>>n; > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator