/home/toolbox/public_html/solutions/117/11764/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: 2015-03-21
20 * Purpose:
21 * Problem: 11764
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 #define MAX_WALLS 55
29
30 int numberOfTimes;
31 int numWalls;
32 int walls[MAX_WALLS];
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 i;
49
50 scanf(" %d ", &numWalls);
51 for (i=0 ; i< numWalls; i++)
52 {
53 /* for */
54 scanf(" %d ", &walls[i]);
55 } /* for */
56 } /* FUNCTION getInput */
57
58 void process()
59 {
60 /* FUNCTION process */
61 int i;
62 int prev;
63 int down = 0;
64 int up = 0;
65
66 prev = walls[0];
67 for (i=1; i<numWalls; i++)
68 {
69 /* for */
70 if (prev < walls[i])
71 {
72 up++;
73 }
74 if (prev > walls[i])
75 {
76 down++;
77 }
78 prev = walls[i];
79 } /* for */
80 printf("%d %d\n", up, down);
81 } /* FUNCTION process */
82
83 int main()
84 {
85 /* main */
86 int i;
87
88 init();
89 for (i=0; i<numberOfTimes; i++)
90 {
91 /* while */
92 getInput();
93 printf("Case %d: ", i+1);
94 process();
95 } /* while */
96
97 return EXIT_SUCCESS;
98 } /* main */
99
100