diff --git a/0310/1.c b/0310/1.c new file mode 100644 index 0000000..66fc06f --- /dev/null +++ b/0310/1.c @@ -0,0 +1,11 @@ +#include + +int main() { + int n, m, d; + scanf("%d %d", &n, &m); + d = n - m; + if (d < 0) + d = -d; + printf("%d", d); + return 0; +} \ No newline at end of file diff --git a/0310/10.c b/0310/10.c new file mode 100644 index 0000000..97513c6 --- /dev/null +++ b/0310/10.c @@ -0,0 +1,35 @@ +#include +#define to_num(x) \ + { \ + switch (x) { \ + case 'S': \ + x = 3; \ + break; \ + case 'J': \ + x = 2; \ + break; \ + case 'B': \ + x = 1; \ + break; \ + } \ + } + +int main() { + char a, b; + scanf("%c %c", &a, &b); + to_num(a); + to_num(b); + switch (a - b) { + case 0: + printf("DEUCE"); + break; + case 1: + case -2: + printf("FIRST"); + break; + default: + printf("SECOND"); + break; + } + return 0; +} \ No newline at end of file diff --git a/0310/2.c b/0310/2.c new file mode 100644 index 0000000..d85c8e4 --- /dev/null +++ b/0310/2.c @@ -0,0 +1,19 @@ +#include +#define swap(i, j) \ + { \ + int t = i; \ + i = j; \ + j = t; \ + } +#define max(i, j) (((i) > (j)) ? (i) : (j)) +int main() { + int x1, y1, x2, y2; + scanf("%d %d %d %d", &x1, &y1, &x2, &y2); + if (x1 < y1) { + swap(x1, y1); + } + if (x2 < y2) { + swap(x2, y2); + } + printf("%d %d", max(x1, x2), max(y1, y2)); +} \ No newline at end of file diff --git a/0310/3.c b/0310/3.c new file mode 100644 index 0000000..f97cfc1 --- /dev/null +++ b/0310/3.c @@ -0,0 +1,7 @@ +#include +int main() { + int n; + scanf("%d", &n); + printf("%s", n % 2 == 0 ? "even" : "odd"); + return 0; +} \ No newline at end of file diff --git a/0310/4.c b/0310/4.c new file mode 100644 index 0000000..b4c7783 --- /dev/null +++ b/0310/4.c @@ -0,0 +1,8 @@ +#include + +int main() { + int a, b; + scanf("%d %d", &a, &b); + printf("%s", a % b == 0 || b % a == 0 ? "TRUE" : "FALSE"); + return 0; +} \ No newline at end of file diff --git a/0310/5.c b/0310/5.c new file mode 100644 index 0000000..4a9a998 --- /dev/null +++ b/0310/5.c @@ -0,0 +1,10 @@ +#include +#define putbool(x) (printf("%s", (x) ? "TRUE" : "FALSE")) +#define cube(x) ((x) * (x) * (x)) + +int main() { + int n; + scanf("%d", &n); + putbool(cube(n % 10) + cube(n / 10 % 10) + cube(n / 100) == n); + return 0; +} \ No newline at end of file diff --git a/0310/6.c b/0310/6.c new file mode 100644 index 0000000..81cf625 --- /dev/null +++ b/0310/6.c @@ -0,0 +1,30 @@ +#include + +int main() { + int n; + scanf("%d", &n); + if (n < 0 || n > 100) { + printf("Score is error!"); + return 0; + } + switch (n / 10) { + break; + case 6: + putchar('D'); + break; + case 7: + putchar('C'); + break; + case 8: + putchar('B'); + break; + case 9: + case 10: + putchar('A'); + break; + default: + putchar('E'); + break; + } + return 0; +} \ No newline at end of file diff --git a/0310/7.c b/0310/7.c new file mode 100644 index 0000000..727cb26 --- /dev/null +++ b/0310/7.c @@ -0,0 +1,9 @@ +#include +#define max(a, b) ((a) > (b) ? (a) : (b)) + +int main() { + int a, b, c; + scanf("%d %d %d", &a, &b, &c); + printf("%d", max(max(a, b), c)); + return 0; +} \ No newline at end of file diff --git a/0310/8.c b/0310/8.c new file mode 100644 index 0000000..198f27f --- /dev/null +++ b/0310/8.c @@ -0,0 +1,10 @@ +#include +#include +#define putbool(x) (printf("%s", (x) ? "TRUE" : "FALSE")) + +int main() { + int a, b; + scanf("%d %d", &a, &b); + putbool(abs(a - b) == 1); + return 0; +} \ No newline at end of file diff --git a/0310/9.c b/0310/9.c new file mode 100644 index 0000000..f7ab82f --- /dev/null +++ b/0310/9.c @@ -0,0 +1,9 @@ +#include +#define putbool(x) (printf("%s", (x) ? "TRUE" : "FALSE")) + +int main() { + int a, b, c; + scanf("%d %d %d", &a, &b, &c); + putbool(a <= b && b <= c); + return 0; +} \ No newline at end of file