about summary refs log tree commit diff
path: root/codechef/fibeasy.c
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/fibeasy.c')
-rw-r--r--codechef/fibeasy.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/codechef/fibeasy.c b/codechef/fibeasy.c
new file mode 100644
index 0000000..d5309a5
--- /dev/null
+++ b/codechef/fibeasy.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+const char LAST[] = "0923";
+
+int main()
+{
+	int t, c;
+	long n;
+
+	scanf("%d", &t);
+	while (t--) {
+		scanf("%ld", &n);
+		if (n == 2 || n == 3) {
+			puts("1");
+			continue;
+		}
+
+		for (c = 0; n >>= 1; c++);
+		printf("%c\n", LAST[c % 4]);
+	}
+
+	return 0;
+}