/home/toolbox/public_html/solutions/119/11936/a.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
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /* fprintf(stderr, "functionName: message", varslist); */
16
17 /*
18 * Author: Isaac Traxler
19 * Date: 2020-09-10
20 * Purpose: fun
21 * Problem: 11936
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 int numberOfTimes;
29 int s1;
30 int s2;
31 int s3;
32
33 void init()
34 {
35 /* FUNCTION init */
36 scanf("%d ", &numberOfTimes);
37 } /* FUNCTION init */
38
39 void dump()
40 {
41 /* FUNCTION dump */
42 } /* FUNCTION dump */
43
44 void getInput()
45 {
46 /* FUNCTION getInput */
47 scanf(" %d %d %d ", &s1, &s2, &s3);
48 } /* FUNCTION getInput */
49
50 void process()
51 {
52 /* FUNCTION process */
53 /*
54 * ok if the following:
55 * - all 3 the same length
56 * - 2 are same and 3rd < sum of other 2
57 * - largest is < sum of other 2
58 */
59 int tmp;
60
61 if ((s1 == s2) && (s2 == s3))
62 {
63 /* all same length */
64 printf("OK\n");
65 } /* all same length */
66 else if (((s1 == s2) && ((s1 + s2) > s3)) ||
67 ((s1 == s3) && ((s1 + s3) > s2)) ||
68 ((s2 == s3) && ((s2 + s3) > s1)))
69 {
70 /* two same length and third is less than sum of two equal */
71 printf("OK\n");
72 } /* two same length and third is less than sum of two equal */
73 else
74 {
75 /* all different lengths */
76 /* find longest */
77 tmp = (s1 > s2) ? ((s1 > s3) ? s1 : s3) : (s2 > s3) ? s2 : s3;
78 if ((tmp + tmp) < (s1 + s2 + s3))
79 {
80 /* longest is less than sum of other two */
81 printf("OK\n");
82 } /* longest is less than sum of other two */
83 else
84 printf("Wrong!!\n");
85 } /* all different lengths */
86
87 } /* FUNCTION process */
88
89 int main()
90 {
91 /* main */
92 int i;
93
94 init();
95 for (i=0; i<numberOfTimes; i++)
96 {
97 /* while */
98 getInput();
99 process();
100 } /* while */
101
102 return EXIT_SUCCESS;
103 } /* main */
104
105