about summary refs log tree commit diff
path: root/codechef/matchs.scm
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-05-14 11:55:28 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-05-14 11:55:28 +0700
commit267b2db7addc95c5eebb8bfb9ceeb7b953d85732 (patch)
tree8a9669a99fccaf520b3cb690143e539c58a92ca5 /codechef/matchs.scm
parent887c286cc8228e13f85b587ab92b37e920161eb9 (diff)
downloadcp-267b2db7addc95c5eebb8bfb9ceeb7b953d85732.tar.gz
I has always believed that I'm good at solving math problems
Turns out I has been wrong all the time. And I'm not alone.
Diffstat (limited to 'codechef/matchs.scm')
-rw-r--r--codechef/matchs.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/codechef/matchs.scm b/codechef/matchs.scm
new file mode 100644
index 0000000..2897b6d
--- /dev/null
+++ b/codechef/matchs.scm
@@ -0,0 +1,13 @@
+(define (match big smol ari)
+  (let ((mod (modulo big smol)))
+    (if (or (= mod 0) (> (quotient big smol) 1))
+        ari
+        (match smol mod (not ari)))))
+
+(let loop ((i (read)))
+  (when (> i 0)
+    (let ((n (read)) (m (read)))
+        (display (if (match (max n m) (min n m) #t)
+                     "Ari\n"
+                     "Rich\n")))
+    (loop (1- i))))