#include #include #include #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 1; } results[index] = value; if (value > max_value) { max_value = value; } index++; } if (index == 0) { printf("Neboli načítané žiadne platné údaje.\n"); return 1; } 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); break; } } return 0; }