41 lines
867 B
C
41 lines
867 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, "Error: Too many competitors!\n");
|
|
return 1;
|
|
}
|
|
results[index] = value;
|
|
if (value > max_value) {
|
|
max_value = value;
|
|
}
|
|
index++;
|
|
}
|
|
|
|
if (index == 0) {
|
|
printf("No valid data were entered.\n");
|
|
return 1;
|
|
}
|
|
|
|
printf("Competitors with the highest number of drinks:\n");
|
|
for (int i = 0; i < index; i++) {
|
|
if (results[i] == max_value) {
|
|
printf("%d\n", i);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|