Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int v, p, t; scanf("%d %d %d", &v, &p, &t);
- for (; t != 0; scanf("%d %d %d", &v, &p, &t)) {
- int tempos[p];
- for (int i = 0; i < p; i++) {
- int d; scanf("%d", &d);
- tempos[i] = (d*3.6)/v;
- }
- //printf("tempos corretos: "); for (int i = 0; i < p; i++) printf("%lf ", tempos[i]); printf("\n");
- int clas[t];
- for (int i = 0; i < t; i++) clas[i] = i + 1;
- int pontos[t];
- for (int i = 0; i < t; i++) pontos[i] = 0;
- for (int i = 0; i < t; i++) {
- for (int j = 0; j < p; j++) {
- int k; scanf("%d", &k);
- if (k < tempos[j]) {
- if (2 * (tempos[j] - k) > 1200) pontos[i] += 1200;
- else pontos[i] += 2 * (tempos[j] - k);
- }
- else {
- if (k - tempos[j] > 1200) pontos[i] += 1200;
- else pontos[i] += k - tempos[j];
- }
- }
- //printf("%d: %lf\n", i, pontos[i]);
- }
- for (int i = 0; i < t; i++) {
- for (int j = 0; j < t - 1 - i; j++) {
- if (pontos[j] > pontos [j + 1]){
- double temp = pontos[j+1];
- pontos[j+1] = pontos[j];
- pontos[j] = temp;
- temp = clas[j+1];
- clas[j+1] = clas[j];
- clas[j] = temp;
- }
- }
- }
- for (int i = 0; i < t; i++) printf(i == 0 ? "%d" : " %d", clas[i]); printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement