| ||||||||||
| 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 | |||||||||
HELP 一直WA啊#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
#define MAX 10
int a[MAX];
int main()
{
int ca = 0;
int n = 0;
while(scanf("%d",&n)==1&&n != 0)
{
ca++;
int ave = 0;
for(int i = 0;i < n;i++)
{
scanf("%d",&a[i]);
ave+=a[i];
}
ave/=n;
int ans = 0;
for(int j=0;j < n;j++)
{
if(a[j]>ave)
{
ave = a[j] - ave;
ans++;
}
}
printf("Set #%d\n",ca);
printf("The minimum number of moves is %d.\n\n",ans);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator