This commit is contained in:
Bluemangoo 2025-03-04 19:23:15 +08:00
parent 87611d8794
commit 7d9d3d66eb
Signed by: Bluemangoo
GPG Key ID: F2F7E46880A1C4CF
10 changed files with 148 additions and 0 deletions

11
0310/1.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main() {
int n, m, d;
scanf("%d %d", &n, &m);
d = n - m;
if (d < 0)
d = -d;
printf("%d", d);
return 0;
}

35
0310/10.c Normal file
View File

@ -0,0 +1,35 @@
#include <stdio.h>
#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;
}

19
0310/2.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdio.h>
#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));
}

7
0310/3.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
printf("%s", n % 2 == 0 ? "even" : "odd");
return 0;
}

8
0310/4.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%s", a % b == 0 || b % a == 0 ? "TRUE" : "FALSE");
return 0;
}

10
0310/5.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#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;
}

30
0310/6.c Normal file
View File

@ -0,0 +1,30 @@
#include <stdio.h>
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;
}

9
0310/7.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#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;
}

10
0310/8.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <math.h>
#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;
}

9
0310/9.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#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;
}