about summary refs log tree commit diff
path: root/others/easy20160714/05.c
blob: 4e0e58f13d0550e1382f72927ca3cbe9acc0cc3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>

int main()
{
	FILE *f = fopen("INP.TXT", "r");
	unsigned long long x, y;
	char z = 1;

	fscanf(f, "%lld", &x);

	fclose(f);

	f = fopen("OUT.TXT", "w");

	y = x;

	while (y ^ 1) {
		if (y % 2)
			y = y / 2 + 1;
		else
			y /= 2;

		z++;
	}

	fprintf(f, "%hhd ", z);

	z = 1;

	while (x ^ 1) {
		x /= 2;
		z++;
	}

	fprintf(f, "%hhd\n", z);

	fclose(f);

	return 0;
}