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:为什么PE?求解……In Reply To:为什么PE?求解…… Posted by:1004105217 at 2012-06-21 15:43:29 > #include<iostream> > using namespace std; > int main() > { > int n,a[10000],k=0,sum=0,t=0,i; > while(cin>>n&&n!=0) > { > k++; > sum=0; > t=0; > for( i=0;i<n;i++) > { > cin>>a[i]; > sum+=a[i]; > } > for(i=0;i<n;i++) > { > if(a[i]>sum/n) > t+=a[i]-sum/n; > } > cout<<"Set #"<<k<<endl; > cout<<"The minimum number of moves is "<<t<<"."<<endl; > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator