/home/toolbox/public_html/solutions/114/11479/b.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <math.h>
8 #include <stdint.h>
9 #include <ctype.h>
10
11 #define TRUE (1 == 1)
12 #define FALSE (1 != 1)
13
14 #define DEBUG if (FALSE)
15
16 /* fprintf(stderr, "functionName: message", varslist); */
17
18 /*
19 * Author: Isaac Traxler
20 * Date: 2021-12-5
21 * Purpose: fun
22 * Problem: 11479 - Is this the easiest problem?
23 */
24
25 /*
26 * This template reads data a specified number of times.
27 */
28
29 int numberOfTimes;
30 int s1;
31 int s2;
32 int s3;
33
34 void init()
35 {
36 /* FUNCTION init */
37 scanf("%d ", &numberOfTimes);
38 } /* FUNCTION init */
39
40 void dump()
41 {
42 /* FUNCTION dump */
43 } /* FUNCTION dump */
44
45 void getInput()
46 {
47 /* FUNCTION getInput */
48 int tmp;
49
50 scanf(" %d %d %d ", &s1, &s2, &s3);
51 /* sort them in increasing order */
52 if (s1 > s2)
53 {
54 /* swap them */
55 tmp = s1;
56 s1 = s2;
57 s2 = tmp;
58 } /* swap them */
59 if (s2 > s3)
60 {
61 /* swap them */
62 tmp = s2;
63 s2 = s3;
64 s3 = tmp;
65 if (s1 > s2)
66 {
67 /* swap them */
68 tmp = s1;
69 s1 = s2;
70 s2 = tmp;
71 } /* swap them */
72 } /* swap them */
73 } /* FUNCTION getInput */
74
75 void process()
76 {
77 /* FUNCTION process */
78
79 printf("%d %d %d ", s1, s2, s3);
80 if ((0 >= s1) || ((s1+s2) <= s3))
81 {
82 /* a side is not positive or s3 is longer than sum of s1 and s2 -- invlaid */
83 printf("Invalid\n");
84 } /* a side is not positive or s3 is longer than sum of s1 and s2 -- invlaid */
85 else
86 {
87 /* now figure out what kind we have */
88 if (s1 == s2)
89 {
90 /* first 2 sides match */
91 if (s2 == s3)
92 {
93 /* all three sides match */
94 printf("Equilateral\n");
95 } /* all three sides match */
96 else
97 {
98 /* only 2 sides match */
99 printf("Isosceles\n");
100 } /* only 2 sides match */
101 } /* first 2 sides match */
102 else
103 {
104 /* check 2nd and third sides */
105 if (s2 == s3)
106 {
107 /* only 2 sides match */
108 printf("Isosceles\n");
109 } /* only 2 sides match */
110 else
111 {
112 /* all three are different */
113 printf("Scalene\n");
114 } /* all three are different */
115 } /* check 2nd and third sides */
116 } /* now figure out what kind we have */
117 } /* FUNCTION process */
118
119 int main()
120 {
121 /* main */
122 int i;
123
124 init();
125 for (i=1; i<=numberOfTimes; i++)
126 {
127 /* while */
128 getInput();
129 printf("Case %d: ", i);
130 process();
131 } /* while */
132
133 return EXIT_SUCCESS;
134 } /* main */
135
136