/home/toolbox/public_html/solutions/113/11384/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 #include <ctype.h>
10
11 #define TRUE (1 == 1)
12 #define FALSE (1 != 1)
13
14 #define DEBUG if (FALSE)
15
16 #define MAX_LINE 257
17
18 /*
19 * Author: Isaac Traxler
20 * Date:
21 * Purpose: fun
22 * Problem:
23 */
24
25 /*
26 * This template reads lines of data at a time until end of file.
27 */
28
29 int num;
30 int twos[31] =
31 {
32 1, 2, 4, 8, 16,
33 32, 64, 128, 256, 512,
34 1024, 2048, 4096, 8192, 16384,
35 32768, 65536, 131072, 262144, 524288,
36 1048576, 2097152, 4194304, 8388608, 16777216,
37 33554432, 67108864, 134217728, 268435456, 536870912,
38 1073741824
39 };
40
41 void init()
42 {
43 /* FUNCTION init */
44
45 } /* FUNCTION init */
46
47 void dump()
48 {
49 /* FUNCTION dump */
50 } /* FUNCTION dump */
51
52 int getInput()
53 {
54 /* FUNCTION getInput */
55 int dataReadFlag;
56
57 dataReadFlag = (1 == scanf(" %d ", &num));
58 return (dataReadFlag);
59 } /* FUNCTION getInput */
60
61 void process()
62 {
63 /* FUNCTION process */
64 int i;
65 int over = 30;
66
67 for (i=0; 32>i; i++)
68 {
69 /* for each possible place */
70 if (twos[i] > num)
71 {
72 /* found value */
73 over = i;
74 i=33;
75 } /* found value */
76 } /* for each possible place */
77 printf("%d\n", over);
78 } /* FUNCTION process */
79
80 int main()
81 {
82 /* main */
83 int moreToDo;
84
85 init();
86 moreToDo = getInput();
87 while (moreToDo)
88 {
89 /* while */
90 process();
91 moreToDo = getInput();
92 } /* while */
93
94 return EXIT_SUCCESS;
95 } /* main */
96