/home/toolbox/public_html/solutions/2/294/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: 20150922
20 * Purpose: fun
21 * Problem: 294 - divisors
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 #define MAX_NUMBER 1000000001
29
30 int numberOfTimes;
31 int L;
32 int U;
33 unsigned short ary[MAX_NUMBER] = {0};
34
35 void init()
36 {
37 /* FUNCTION init */
38 int i;
39 int j;
40 int tmp;
41 int mx = 0;
42 int cnt;
43
44 scanf("%d ", &numberOfTimes);
45 ary[1] = 1;
46 for (i=2; MAX_NUMBER>i; i++)
47 {
48 /* try each number */
49 printf("i=%d mx=%d\n", i, mx);
50 for (j=i*2; j<MAX_NUMBER; j=j+i)
51 {
52 /* mark all multiples - add 1 to count since it is a multiple of i*/
53 ary[j]++;
54 } /* mark all multiples - add 1 to count since it is a multiple of i*/
55 ary[i] = ary[i] + 2; /* add 1 and i as factors */
56 if (mx < ary[i])
57 {
58 mx = ary[i];
59 }
60 } /* try each number */
61 } /* FUNCTION init */
62
63 void dump()
64 {
65 /* FUNCTION dump */
66 } /* FUNCTION dump */
67
68 void getInput()
69 {
70 /* FUNCTION getInput */
71 scanf(" %d %d ", &L, &U);
72 } /* FUNCTION getInput */
73
74 void process()
75 {
76 /* FUNCTION process */
77 } /* FUNCTION process */
78
79 int main()
80 {
81 /* main */
82 int i;
83
84 init();
85 for (i=0; i<numberOfTimes; i++)
86 {
87 /* while */
88 getInput();
89 process();
90 } /* while */
91
92 return EXIT_SUCCESS;
93 } /* main */
94
95