2020-03-02 13:52:42 +00:00
|
|
|
#include <stdio.h>
|
2020-03-02 19:16:10 +00:00
|
|
|
#define VELKOST_POLA 50
|
2020-03-02 13:52:42 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int pole[VELKOST_POLA] = {0,0,0,0};
|
|
|
|
|
2020-03-02 19:16:10 +00:00
|
|
|
int i = 0, max_hodnota = 0, quant_max = 0, value = 0, indexMan = 0;
|
|
|
|
while(value >= 0 || i <= 49 || value != EOF){
|
|
|
|
int r = scanf("%d",&value);
|
|
|
|
|
|
|
|
if(value <= -1){
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(max_hodnota < value){
|
|
|
|
max_hodnota = value;
|
|
|
|
indexMan = i+1;
|
|
|
|
quant_max = 0;
|
|
|
|
} else if(max_hodnota == value){
|
|
|
|
quant_max++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(r == 1){
|
|
|
|
pole[i] = value;
|
|
|
|
i++;
|
|
|
|
|
|
|
|
fprintf(stdout, "Súťažiaci č. %d vypil %d pohárov.\n", i, pole[i-1]);
|
|
|
|
} else{
|
|
|
|
break;
|
2020-03-02 13:52:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 19:16:10 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", indexMan, max_hodnota);
|
2020-03-02 13:52:42 +00:00
|
|
|
|
|
|
|
return 0;
|
2020-02-26 10:03:57 +00:00
|
|
|
}
|
2020-03-02 13:52:42 +00:00
|
|
|
|
2020-03-02 19:16:10 +00:00
|
|
|
|