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

我刷题刷傻了qwq

Posted by KatrineYang at 2016-08-19 05:05:03 on Problem 3665
这么个水题三次WA一次TLE。。。
王记把R值置洞两次WA
下标王记+1一次WA
还有一次TLE人家只要求最大值你排毛线序啊qwq
#include <stdio.h>

int R[1000];

int main() {
	int N, T;
	scanf("%d%d", &N, &T);
	for(int i = 0; i < N; i++) scanf("%d", &R[i]);
	for(int i = 0; i < T; i++){
		int maxR = -1, arg = -1;
		for(int j = 0; j < N; j++){
			if(R[j] > maxR){
				maxR = R[j];
				arg = j;
			}
		}
		printf("%d\n", arg+1);
		int f = R[arg];
		R[arg] = 0;
		int duo = f%(N-1);
		int j = f/(N-1);
		int cnt = 0;
		for(int i = 0; i < N; i++){
			if(i == arg) continue;
			R[i] += j;
			if(cnt < duo){
				R[i]++;
				cnt++;
			}
		}
	}
	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