2025-02-25 17:19:22 +00:00
|
|
|
#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) {
|
2025-02-25 17:25:40 +00:00
|
|
|
fprintf(stderr, "Chyba: Príliš veľa súťažiacich!\n");
|
2025-02-25 17:34:04 +00:00
|
|
|
return 0;
|
2025-02-25 17:19:22 +00:00
|
|
|
}
|
|
|
|
results[index] = value;
|
|
|
|
if (value > max_value) {
|
|
|
|
max_value = value;
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index == 0) {
|
2025-02-25 17:42:28 +00:00
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2025-02-25 17:39:21 +00:00
|
|
|
return 0;
|
2025-02-25 17:19:22 +00:00
|
|
|
}
|
|
|
|
|
2025-02-25 17:25:40 +00:00
|
|
|
for (int i = 0; i < index; i++) {
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
|
|
|
}
|
|
|
|
|
2025-02-25 17:19:22 +00:00
|
|
|
for (int i = 0; i < index; i++) {
|
|
|
|
if (results[i] == max_value) {
|
2025-02-25 17:25:40 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, max_value);
|
2025-02-25 17:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|