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 |
这也太水了吧#include <iostream> #include <stdio.h> using namespace std; int block[500]; int n; int main() { int cnt = 0; while(1){ scanf("%d", &n); if(!n) return 0; cnt++; printf("Set #%d\n", cnt); int sum = 0; for(int i = 0; i < n; i++){ scanf("%d", &block[i]); sum += block[i]; } sum /= n; int ans = 0; for(int i = 0; i < n; i++){ if(block[i] > sum){ ans += (block[i]-sum); } } 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