44 lines
1010 B
C
44 lines
1010 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define ARRAY_SIZE 52
|
|
|
|
int main() {
|
|
int results[ARRAY_SIZE];
|
|
memset(results, 0, ARRAY_SIZE * sizeof(int));
|
|
|
|
int index = 0;
|
|
int max_value = 0;
|
|
int value;
|
|
|
|
while (scanf("%d", &value) == 1 && value > 0) {
|
|
if (index >= ARRAY_SIZE) {
|
|
fprintf(stderr, "Chyba: Príliš veľa súťažiacich!\n");
|
|
return 0;
|
|
}
|
|
results[index] = value;
|
|
if (value > max_value) {
|
|
max_value = value;
|
|
}
|
|
index++;
|
|
}
|
|
|
|
if (index == 0) {
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
|
return 0;
|
|
}
|
|
|
|
for (int i = 0; i < index; i++) {
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
|
}
|
|
|
|
for (int i = 0; i < index; i++) {
|
|
if (results[i] == max_value) {
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, max_value);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|