about summary refs log tree commit diff
path: root/others/easy20160714/05.c
diff options
context:
space:
mode:
Diffstat (limited to 'others/easy20160714/05.c')
-rw-r--r--others/easy20160714/05.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/others/easy20160714/05.c b/others/easy20160714/05.c
new file mode 100644
index 0000000..4e0e58f
--- /dev/null
+++ b/others/easy20160714/05.c
@@ -0,0 +1,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;
+}