/home/toolbox/public_html/solutions/118/11850/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 <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9 #include <ctype.h>
10
11 #define TRUE (1 == 1)
12 #define FALSE (1 != 1)
13
14 #define DEBUG if (FALSE)
15
16 /*
17 * Author: Isaac Traxler
18 * Date: 2021-12-6
19 * Purpose: fun
20 * Problem: 11850 - Alaska
21 */
22
23 /*
24 * This template reads data until a terminating value is reached.
25 */
26
27 #define MAX 200
28 #define START 1422
29
30 int cnt;
31
32 void init()
33 {
34 /* FUNCTION init */
35 } /* FUNCTION init */
36
37 void dump()
38 {
39 /* FUNCTION dump */
40 } /* FUNCTION dump */
41
42 int getInput()
43 {
44 /* FUNCTION getInput */
45 int dataReadFlag;
46
47 scanf(" %d ", &cnt);
48 dataReadFlag = (0 != cnt);
49 return (dataReadFlag);
50 } /* FUNCTION getInput */
51
52 void process()
53 {
54 /* FUNCTION process */
55 int i;
56 int dist;
57 int next;
58 int madeIt = TRUE;
59
60 dist = START;
61 for (i=0; cnt>i; i++)
62 {
63 /* get location */
64 scanf(" %d ", &next);
65 if (MAX >= (dist - next))
66 {
67 /* failed */
68 DEBUG printf(" (max %d) > (%d = %d - %d)\n", MAX, (dist-next), dist, next);
69 madeIt = FALSE;
70 } /* failed */
71 dist = next;
72 } /* get location */
73 madeIt = madeIt && (MAX >= dist);
74 if (madeIt)
75 {
76 printf("POSSIBLE\n");
77 }
78 else
79 {
80 printf("IMPOSSIBLE\n");
81 }
82 } /* FUNCTION process */
83
84 int main()
85 {
86 /* main */
87 int moreToDo;
88
89 init();
90 moreToDo = getInput();
91 while (moreToDo)
92 {
93 /* while */
94 process();
95 moreToDo = getInput();
96 } /* while */
97
98 return EXIT_SUCCESS;
99 } /* main */
100