2025-02-25 07:52:54 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main() {
|
2025-02-25 08:53:23 +00:00
|
|
|
char c = getchar();
|
|
|
|
char loading_string[999] = {};
|
|
|
|
int string_index = 0;
|
|
|
|
while(c != EOF) {
|
|
|
|
loading_string[string_index] = c;
|
|
|
|
string_index++;
|
|
|
|
c = getchar();
|
|
|
|
}
|
|
|
|
loading_string[string_index] = '\0';
|
|
|
|
int iterating_index = 0;
|
|
|
|
int user_counter = 1;
|
|
|
|
int max_number_user_pair[2] = {0,0};
|
|
|
|
int starting_index = 0;
|
|
|
|
while(starting_index<string_index) {
|
2025-02-25 09:19:07 +00:00
|
|
|
while (loading_string[iterating_index] != ' ' && loading_string[iterating_index] != '\0' && loading_string[iterating_index] != '\n') {
|
2025-02-25 08:53:23 +00:00
|
|
|
iterating_index++;
|
|
|
|
}
|
2025-02-25 09:21:00 +00:00
|
|
|
if (loading_string[iterating_index] == '\n') break;
|
2025-02-25 09:01:53 +00:00
|
|
|
int number_size = iterating_index-starting_index;
|
2025-02-25 08:53:23 +00:00
|
|
|
int current_number = 0;
|
|
|
|
for (int l=0;l<number_size;l++) {
|
|
|
|
int temporary_number = loading_string[starting_index+l]-'0';
|
|
|
|
for (int k=number_size-1;k>0;k--) {
|
|
|
|
temporary_number = temporary_number * 10;
|
|
|
|
}
|
|
|
|
current_number += temporary_number;
|
|
|
|
}
|
|
|
|
if (current_number > max_number_user_pair[0]) {
|
|
|
|
max_number_user_pair[0] = current_number;
|
|
|
|
max_number_user_pair[1] = user_counter;
|
|
|
|
}
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", user_counter, current_number);
|
|
|
|
user_counter++;
|
2025-02-25 09:01:53 +00:00
|
|
|
iterating_index++;
|
2025-02-25 08:55:25 +00:00
|
|
|
starting_index = iterating_index;
|
2025-02-25 08:53:23 +00:00
|
|
|
}
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max_number_user_pair[1], max_number_user_pair[0]);
|
2025-02-25 07:52:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|