/home/toolbox/public_html/solutions/126/12614/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
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-10-04
20 * Purpose: fun
21 * Problem: 12614 - Earn for Future!
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 #define MAX_NUMBERS 32
29
30 int numberOfTimes;
31 int numbers;
32 unsigned int N[MAX_NUMBERS];
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 ", &numbers);
51 for (i=0; i<numbers; i++)
52 {
53 /* for each number */
54 scanf(" %d ", &N[i]);
55 } /* for each number */
56 } /* FUNCTION getInput */
57
58 void process()
59 {
60 /* FUNCTION process */
61 unsigned int tmp;
62 int i;
63
64 tmp = N[0];
65 for (i=1; i<numbers; i++)
66 {
67 /* for each number */
68 tmp = tmp & N[i];
69 printf("%d\n", tmp);
70 } /* for each number */
71 } /* FUNCTION process */
72
73 int main()
74 {
75 /* main */
76 int i;
77
78 init();
79 for (i=1; i<=numberOfTimes; i++)
80 {
81 /* while */
82 printf("Case %d: ", i);
83 getInput();
84 process();
85 } /* while */
86
87 return EXIT_SUCCESS;
88 } /* main */
89
90