/home/toolbox/public_html/solutions/132/13216/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:
20 * Purpose: fun
21 * Problem:
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 #define LINE_MAX 1024
29
30 int numberOfTimes;
31 int tbl[10];
32 char line[LINE_MAX];
33
34 void init()
35 {
36 /* FUNCTION init */
37 scanf("%d ", &numberOfTimes);
38 tbl[0] = 7;
39 tbl[1] = 1;
40 tbl[2] = 5;
41 tbl[3] = 9;
42 tbl[4] = 3;
43 tbl[5] = 7;
44 tbl[6] = 1;
45 tbl[7] = 5;
46 tbl[8] = 9;
47 tbl[9] = 3;
48 } /* FUNCTION init */
49
50 void dump()
51 {
52 /* FUNCTION dump */
53 } /* FUNCTION dump */
54
55 void getInput()
56 {
57 /* FUNCTION getInput */
58 scanf(" %s ", line);
59 DEBUG printf("line: %s\n", line);
60 } /* FUNCTION getInput */
61
62 void process()
63 {
64 /* FUNCTION process */
65 int slen;
66
67 slen = strlen(line);
68 DEBUG printf("%d %c [%s]\n", slen, line[slen - 1], line);
69 if (1 == slen)
70 {
71 /* 1 digit input */
72 if ('0' == line[0])
73 {
74 printf("1\n");
75 }
76 else if ('1' == line[0])
77 {
78 printf("66\n");
79 }
80 else
81 {
82 printf("%d6\n", tbl[line[0] - '0']);
83 }
84 } /* 1 digit input */
85 else
86 {
87 /* longer input -- go by last digit */
88 printf("%d6\n", tbl[line[slen - 1] - '0']);
89 } /* longer input -- go by last digit */
90 } /* FUNCTION process */
91
92 int main()
93 {
94 /* main */
95 int i;
96
97 init();
98 for (i=0; i<numberOfTimes; i++)
99 {
100 /* while */
101 getInput();
102 process();
103 } /* while */
104
105 return EXIT_SUCCESS;
106 } /* main */
107
108