Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么PE?求解……

Posted by heijiaotuan at 2012-07-06 18:31:37 on Problem 1477
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator