/home/toolbox/public_html/solutions/122/12279/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 <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /*
16 * Author: Isaac Traxler
17 * Date: 2016-10-04
18 * Purpose: fun
19 * Problem: 12279 - Emoogle Balance
20 */
21
22 /*
23 * This template reads data until a terminating value is reached.
24 */
25
26 int cnt;
27
28 void init()
29 {
30 /* FUNCTION init */
31 } /* FUNCTION init */
32
33 void dump()
34 {
35 /* FUNCTION dump */
36 } /* FUNCTION dump */
37
38 int getInput()
39 {
40 /* FUNCTION getInput */
41 int dataReadFlag;
42
43 scanf(" %d ", &cnt);
44 dataReadFlag = (0 != cnt);
45 return (dataReadFlag);
46 } /* FUNCTION getInput */
47
48 void process()
49 {
50 /* FUNCTION process */
51 int i;
52 int tot = 0;
53 int tmp;
54
55 for (i=0; i<cnt; i++)
56 {
57 /* for each event */
58 scanf(" %d ", &tmp);
59 if (0 < tmp)
60 {
61 tot++;
62 }
63 else
64 {
65 tot--;
66 }
67 } /* for each event */
68 printf("%d\n", tot);
69 } /* FUNCTION process */
70
71 int main()
72 {
73 /* main */
74 int moreToDo;
75 int cs = 1;
76
77 init();
78 moreToDo = getInput();
79 while (moreToDo)
80 {
81 /* while */
82 printf ("Case %d: ", cs++);
83 process();
84 moreToDo = getInput();
85 } /* while */
86
87 return EXIT_SUCCESS;
88 } /* main */
89