标签:otto strong ima line war typedef ike sample rds
传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=2088
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 20219 Accepted Submission(s): 6473
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define max_v 50 int a[max_v]; int main() { int n,k=0; while(~scanf("%d",&n)) { if(n==0) break; if(k) printf("\n");//注意输出格式,最后一个测试不能有空行 int sum=0; for(int i=0; i<n; i++) { scanf("%d",&a[i]); sum+=a[i]; } sum/=n;//平均 int c=0; for(int i=0; i<n; i++) { if(a[i]<sum)//小于平均的栈其差多少的和就是需要移动的总数 c+=(sum-a[i]); } printf("%d\n",c); k++; } return 0; }
标签:otto strong ima line war typedef ike sample rds
原文地址:https://www.cnblogs.com/yinbiao/p/9307528.html