2024-02-29 17:29:17 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
int results[50];
|
|
|
|
int count = 0;
|
|
|
|
int max = 0;
|
|
|
|
|
2024-02-29 17:37:48 +00:00
|
|
|
|
2024-02-29 17:29:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (count < 50 && scanf ("%d", &results[count]) == 1){
|
|
|
|
|
|
|
|
if (results[count] == EOF){
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (results[count] < 1){
|
2024-02-29 18:10:15 +00:00
|
|
|
|
2024-02-29 18:08:50 +00:00
|
|
|
break;
|
2024-02-29 17:29:17 +00:00
|
|
|
}
|
|
|
|
count++;
|
2024-02-29 17:43:50 +00:00
|
|
|
}
|
2024-02-29 17:29:17 +00:00
|
|
|
if (count == 0){
|
2024-02-29 18:36:58 +00:00
|
|
|
printf ("Chyba: Málo platných hodnôt.\n");
|
2024-02-29 18:32:57 +00:00
|
|
|
return 0;
|
2024-02-29 17:43:50 +00:00
|
|
|
|
2024-02-29 17:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
int vyhercovia[50];
|
|
|
|
int vyherca = 0 ;
|
|
|
|
|
|
|
|
for ( int i = 0; i < count; i++){
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,results[i]);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < count; i++){
|
|
|
|
if (results[i] > max ) {
|
|
|
|
max = results[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < count; i++){
|
|
|
|
if (results[i] == max ) {
|
|
|
|
vyherca++;
|
|
|
|
vyhercovia[index] = i+1;
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < vyherca; i++){
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",vyhercovia[i],max);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|