about summary refs log tree commit diff
path: root/codechef/bitobyt.lisp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-10-20 11:27:47 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2018-10-20 11:27:47 +0700
commit4c5ed94087a691ce47882786aea64f7b5bf3c130 (patch)
tree6ebb9374e9c9e1d867659a1de166fbe8f6481b19 /codechef/bitobyt.lisp
parent662168dbd56cbeba35bea782d580b0f7cc9a3ac2 (diff)
downloadcp-4c5ed94087a691ce47882786aea64f7b5bf3c130.tar.gz
Bon appétit
Diffstat (limited to 'codechef/bitobyt.lisp')
-rw-r--r--codechef/bitobyt.lisp10
1 files changed, 10 insertions, 0 deletions
diff --git a/codechef/bitobyt.lisp b/codechef/bitobyt.lisp
new file mode 100644
index 0000000..6a26b93
--- /dev/null
+++ b/codechef/bitobyt.lisp
@@ -0,0 +1,10 @@
+(let ((tests (read)))
+  (dotimes (i tests)
+    (let ((n (read)))
+      (if (= n 0)
+          (format t "1 0 0~&")
+          (multiple-value-bind (d m) (truncate (1- n) 26)
+            (format t (cond ((< m 2) "~a 0 0~&")
+                            ((< m 10) "0 ~a 0~&")
+                            (t "0 0 ~a~&"))
+                    (expt 2 d)))))))