diff options
Diffstat (limited to 'inf/priprave/dn/1a.c')
-rw-r--r-- | inf/priprave/dn/1a.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/inf/priprave/dn/1a.c b/inf/priprave/dn/1a.c new file mode 100644 index 0000000..84b2c08 --- /dev/null +++ b/inf/priprave/dn/1a.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <stdlib.h> +/* https://codeforces.com/group/Eu6CNrz8hK/contest/349888/problem/A */ +int main (void) { /* TIL: od ISO C11 je to legalno */ + unsigned short int num1 = 9; + unsigned short int num2 = 10; + int c; + while (getchar() != '\n'); + while (1) { + if ((c = getchar()) == EOF) + break; + if (c == '\n') + num2 = 9; + if (c <= '9' && c >= '1') +#define num (*(num2 > 9 ? &num1 : &num2)) + if (c-'0' < num) + num = c-'0'; + } + if (num1 == num2) + printf("%d\n", num1); + else if (num1 < num2) + printf("%d%d\n", num1, num2); + else + printf("%d%d\n", num2, num1); + return 0; +} |