2022-03-08 14:34:11 +00:00
|
|
|
#include <stdio.h>
|
2022-03-09 12:53:51 +00:00
|
|
|
#define VELKOST_POLA 50
|
2022-03-08 14:34:11 +00:00
|
|
|
|
|
|
|
int main(){
|
2022-03-09 12:53:51 +00:00
|
|
|
int results[VELKOST_POLA];
|
2022-03-09 13:35:57 +00:00
|
|
|
int max = 0;
|
2022-03-08 14:34:11 +00:00
|
|
|
int i = 0;
|
2022-03-09 13:37:05 +00:00
|
|
|
int a = 0;
|
2022-03-09 13:42:59 +00:00
|
|
|
int kolvo[10];
|
2022-03-08 14:34:11 +00:00
|
|
|
while(1){
|
2022-03-09 12:53:51 +00:00
|
|
|
int value = 0;
|
|
|
|
int r = scanf("%d",&value);
|
2022-03-09 14:22:25 +00:00
|
|
|
if(r == EOF || r < 0)
|
|
|
|
continue;
|
2022-03-09 14:18:12 +00:00
|
|
|
if (r == 1){
|
2022-03-09 12:53:51 +00:00
|
|
|
results[i] = value;
|
2022-03-09 13:18:13 +00:00
|
|
|
if(max < results[i]){
|
2022-03-09 13:35:57 +00:00
|
|
|
max = results[i];
|
2022-03-09 13:56:18 +00:00
|
|
|
kolvo[a] = i + 1;
|
2022-03-09 13:54:01 +00:00
|
|
|
a = 0;
|
2022-03-09 13:49:58 +00:00
|
|
|
}else if(max == results[i]){
|
2022-03-09 13:58:53 +00:00
|
|
|
if(a == 0){
|
|
|
|
kolvo[a] = i - 1;
|
|
|
|
a++;
|
|
|
|
}
|
2022-03-09 13:54:01 +00:00
|
|
|
kolvo[a] = i;
|
2022-03-09 13:54:21 +00:00
|
|
|
a++;
|
2022-03-09 13:18:13 +00:00
|
|
|
}
|
2022-03-09 13:29:00 +00:00
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,results[i]);
|
2022-03-09 12:53:51 +00:00
|
|
|
i++;
|
2022-03-09 13:08:37 +00:00
|
|
|
}else if(i == 0){
|
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2022-03-09 14:17:18 +00:00
|
|
|
break;
|
2022-03-09 12:53:51 +00:00
|
|
|
}else{
|
2022-03-09 13:51:03 +00:00
|
|
|
if(a == 0){
|
2022-03-09 13:55:49 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",kolvo[a],max);
|
2022-03-09 13:45:29 +00:00
|
|
|
}else{
|
|
|
|
i = 0;
|
|
|
|
do{
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",kolvo[i]+1,max);
|
|
|
|
i++;
|
|
|
|
}while(i < a);
|
|
|
|
}
|
2022-03-09 12:53:51 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-03-09 12:59:22 +00:00
|
|
|
}
|
2022-03-08 14:34:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|