1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00

Compare commits

..

No commits in common. "aabd2bca7bc438cfaca4a9f1f6334f2a6ab13279" and "3040899e0ff77072f5ca466e673501350e44dea4" have entirely different histories.

2 changed files with 0 additions and 72 deletions

View File

@ -1,24 +0,0 @@
#include <math.h>
#include <stdio.h>
int main() {
int x1, y1, x2, y2, x3, y3;
double a, b, c, s, area;
scanf("%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3);
a = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
c = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
if (a + b > c && a + c > b && b + c > a) {
s = (a + b + c) / 2;
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("%.1f %.1f\n", a + b + c, area);
} else {
printf("no triangle!\n");
}
return 0;
}

View File

@ -1,48 +0,0 @@
#include <stdio.h>
#include <string.h>
char a[3], b[3];
int main() {
scanf("%s%s", a, b);
if (a[0] == 'J') {
strcpy(a, "11");
} else if (a[0] == 'Q') {
strcpy(a, "12");
} else if (a[0] == 'K') {
strcpy(a, "13");
} else if (a[0] == 'A') {
strcpy(a, "14");
} else if (a[0] == '2') {
strcpy(a, "15");
}
if (b[0] == 'J') {
strcpy(b, "11");
} else if (b[0] == 'Q') {
strcpy(b, "12");
} else if (b[0] == 'K') {
strcpy(b, "13");
} else if (b[0] == 'A') {
strcpy(b, "14");
} else if (b[0] == '2') {
strcpy(b, "15");
}
int a1 = a[0] - '0', a2 = a[1] - '0';
int b1 = b[0] - '0', b2 = b[1] - '0';
int a0 = a2 * 10 + a1;
int b0 = b2 * 10 + b1;
if (a0 == b0) {
printf("No winner\n");
} else if (a0 > b0) {
printf("Alice win\n");
} else { // a0 < b0
printf("Bob win\n");
}
return 0;
}