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

1744为什么Presentation Error啊???????这是我的程序.

Posted by Zhouye at 2005-02-08 17:33:29
#include <iostream>

using namespace std;
int n,total=0,temp=0,num=1;
int stick[1000];

int main()
{
    cin >> n;
    while(n!=0)
    {
        for(int i=0;i<n;i++)
        {
            cin >> stick[i];
            total=total+stick[i];
        }
        total=total/n;
        for(int i=0;i<n;i++)
        {
            temp+=((stick[i]>total)?(stick[i]-total):(total-stick[i]));
        }
        temp=temp/2;
        cout << "Set #" << num << endl
             << "The minimum number of moves is " << temp 
             << "." << endl;
        temp=0;
        num++;
        total=0;
        cin >> n;
    }
}
            
            
            
    

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