-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSUMMER_Lab02_2.c
75 lines (67 loc) · 1.63 KB
/
SUMMER_Lab02_2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Baekjoon Online Judge # 1925
#include <stdio.h>
int main()
{
int a1, a2, b1, b2, c1, c2;
scanf("%d %d", &a1, &a2);
scanf("%d %d", &b1, &b2);
scanf("%d %d", &c1, &c2);
int l1 = (a1 - b1) * (a1 - b1) + (a2 - b2) * (a2 - b2);
int l2 = (c1 - b1) * (c1 - b1) + (c2 - b2) * (c2 - b2);
int l3 = (a1 - c1) * (a1 - c1) + (a2 - c2) * (a2 - c2);
int l123[3] = { l1, l2, l3 };
for (int i = 0; i < 2; i++)
{
for (int j = i + 1; j < 3; j++)
{
if (l123[i] > l123[j])
{
int temp = l123[i];
l123[i] = l123[j];
l123[j] = temp;
}
}
}
int x1 = a1, x2 = b1, x3 = c1;
int y1 = a2, y2 = b2, y3 = c2;
int s = (x1 * y2 + x2 * y3 + x3 * y1) - (x1 * y3 + x3 * y2 + x2 * y1);
if (a1 == b1 && b1 == c1 || a2 == b2 && b2 == c2 || s == 0)
{
printf("X\n");
}
else if (l1 == l2 && l2 == l3)
{
printf("JungTriangle\n");
}
else if (l1 == l2 || l2 == l3 || l3 == l1)
{
if (l123[2] == l123[0] + l123[1])
{
printf("Jikkak2Triangle\n");
}
else if (l123[2] > l123[0] + l123[1])
{
printf("Dunkak2Triangle\n");
}
else
{
printf("Yeahkak2Triangle\n");
}
}
else
{
if (l123[2] == l123[0] + l123[1])
{
printf("JikkakTriangle\n");
}
else if (l123[2] > l123[0] + l123[1])
{
printf("DunkakTriangle\n");
}
else
{
printf("YeahkakTriangle\n");
}
}
return 0;
}