40 lines
877 B
C
40 lines
877 B
C
#include <stdio.h>
|
|
#define VELKOST_POLA 50
|
|
|
|
int main()
|
|
{
|
|
int pole[VELKOST_POLA] = {0,0,0,0};
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", indexMan, max_hodnota);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|