Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这也太水了吧

Posted by KatrineYang at 2016-10-24 22:53:20 on Problem 1477
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator