| ||||||||||
| 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 | |||||||||
Re:我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙!In Reply To:我的程序到底哪出错了,为什么总是wa。请大哥大姐帮忙! Posted by:hhhh at 2005-08-28 16:09:51 #include <stdio.h>
int 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(str[j]-aver> 0)
count += (str[j]-aver);
printf("Set #%d\n",i);
printf("The minimum number of moves is %d.\n\n",count);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator