/home/toolbox/public_html/solutions/120/12015/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: 2016-01-26
20 * Purpose: fun
21 * Problem: 12015 - Google is Feeling Lucky
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 #define PAGES 10
29 #define MAX_URI_LENGTH 111
30
31 char uri[PAGES][MAX_URI_LENGTH];
32 int rel[PAGES];
33 int max;
34
35 int numberOfTimes;
36
37 void init()
38 {
39 /* FUNCTION init */
40 scanf("%d ", &numberOfTimes);
41 } /* FUNCTION init */
42
43 void dump()
44 {
45 /* FUNCTION dump */
46 } /* FUNCTION dump */
47
48 void getInput()
49 {
50 /* FUNCTION getInput */
51 int i;
52
53 max = 0;
54
55 for (i=0; PAGES>i; i++)
56 {
57 /* for each page */
58 scanf(" %s %d ", uri[i], &rel[i]);
59 if (max < rel[i])
60 {
61 max = rel[i];
62 }
63 } /* for each page */
64 } /* FUNCTION getInput */
65
66 void process()
67 {
68 /* FUNCTION process */
69 int i;
70
71 for (i=0; PAGES>i; i++)
72 {
73 /* check each uri */
74 if (max == rel[i])
75 {
76 printf("%s\n", uri[i]);
77 }
78 } /* check each uri */
79 } /* FUNCTION process */
80
81 int main()
82 {
83 /* main */
84 int i;
85
86 init();
87 for (i=0; i<numberOfTimes; i++)
88 {
89 /* while */
90 printf("Case #%d:\n", i+1);
91 getInput();
92 process();
93 } /* while */
94
95 return EXIT_SUCCESS;
96 } /* main */
97
98