| ||||||||||
| 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 | |||||||||
我刷题刷傻了qwq这么个水题三次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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator