| ||||||||||
| 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 | |||||||||
1744为什么Presentation Error啊???????这是我的程序.#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator