| ||||||||||
| 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 | |||||||||
我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙!#include <stdio.h>
main()
{
int n,i,str[55],aver,j,count;
for(i = 1;;i++)
{
scanf("%d",&n);
if(n == 0)break;
aver = 0;
for(j = 0;j < n;j++)
{
scanf("%d",&str[j]);
aver += str[j];
}
aver /= n;
count = 0;
for(j = 0;j < n;j++)
if(aver - str[j] > 0)
count += (aver - str[j]);
printf("Set #%d\n",i);
printf("The minimum number of moves is %d\n\n",count);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator