2023-03-02 14:33:37 +00:00
|
|
|
#include <stdio.h>
|
2023-03-02 14:49:49 +00:00
|
|
|
#include <stdlib.h>
|
2023-03-04 12:00:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2023-03-02 14:33:37 +00:00
|
|
|
#define VELKOST_POLA 52
|
2023-03-04 12:00:52 +00:00
|
|
|
|
2023-03-02 14:33:37 +00:00
|
|
|
int main(){
|
2023-03-04 12:00:52 +00:00
|
|
|
int i = 0;
|
2023-03-02 14:33:37 +00:00
|
|
|
int pole[VELKOST_POLA];
|
2023-03-04 12:00:52 +00:00
|
|
|
memset(pole, 0, VELKOST_POLA * sizeof(int));
|
|
|
|
int max_hodnota = 0;
|
2023-03-04 12:23:07 +00:00
|
|
|
int max_hrac = 0;
|
2023-03-04 12:00:52 +00:00
|
|
|
int value = 0;
|
|
|
|
int r = 0;
|
2023-03-11 10:46:52 +00:00
|
|
|
//int najlepsi[VELKOST_POLA];
|
|
|
|
//int k=0;
|
2023-03-04 12:00:52 +00:00
|
|
|
while(i < VELKOST_POLA){
|
|
|
|
value = 0;
|
|
|
|
r = scanf("%d", &value);
|
|
|
|
pole[i] = value;
|
2023-03-04 12:27:46 +00:00
|
|
|
if(value<0){
|
2023-03-04 12:28:03 +00:00
|
|
|
return -1;
|
2023-03-04 12:27:46 +00:00
|
|
|
}
|
2023-03-04 11:52:13 +00:00
|
|
|
|
2023-03-04 12:00:52 +00:00
|
|
|
if(r == 1){
|
|
|
|
i++;
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i, value);
|
2023-03-04 11:52:13 +00:00
|
|
|
|
2023-03-04 12:16:56 +00:00
|
|
|
if(value >= max_hodnota){
|
2023-03-04 12:00:52 +00:00
|
|
|
max_hodnota = value;
|
2023-03-04 12:23:07 +00:00
|
|
|
max_hrac = i;
|
2023-03-04 12:00:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-03-04 12:23:07 +00:00
|
|
|
for(int i=0; i<VELKOST_POLA; i++ ){
|
|
|
|
if(max_hodnota==pole[i]){
|
2023-03-04 12:25:39 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i+1, max_hodnota);
|
2023-03-04 12:23:07 +00:00
|
|
|
}
|
2023-03-04 12:16:56 +00:00
|
|
|
}
|
2023-03-04 10:37:00 +00:00
|
|
|
}
|