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:29:12 +00:00
|
|
|
int i = 0, max_hodnota = 0, value = 0;
|
|
|
|
|
2020-03-02 19:16:10 +00:00
|
|
|
while(value >= 0 || i <= 49 || value != EOF){
|
|
|
|
int r = scanf("%d",&value);
|
|
|
|
|
|
|
|
if(value <= -1){
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(max_hodnota < value){
|
|
|
|
max_hodnota = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
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:29:12 +00:00
|
|
|
for(;i >= 0; i--){
|
|
|
|
if(pole[i] == max_hodnota){
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i+1, pole[i]);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|