about summary refs log tree commit diff
path: root/others/volume1
diff options
context:
space:
mode:
Diffstat (limited to 'others/volume1')
-rw-r--r--others/volume1/000.scm2
-rw-r--r--others/volume1/001.scm2
-rw-r--r--others/volume1/003.scm8
-rw-r--r--others/volume1/006.scm8
4 files changed, 20 insertions, 0 deletions
diff --git a/others/volume1/000.scm b/others/volume1/000.scm
new file mode 100644
index 0000000..2757887
--- /dev/null
+++ b/others/volume1/000.scm
@@ -0,0 +1,2 @@
+(display (let* ((a (read)) (b (read)) (c (read)) (d (read)))
+           (if (> c b) "NO\n" "YES\n")))
diff --git a/others/volume1/001.scm b/others/volume1/001.scm
new file mode 100644
index 0000000..4e6573b
--- /dev/null
+++ b/others/volume1/001.scm
@@ -0,0 +1,2 @@
+(display (let ((a (read)) (b (read))) (exact->inexact (/ (+ a b) 2))))
+(newline)
diff --git a/others/volume1/003.scm b/others/volume1/003.scm
new file mode 100644
index 0000000..21431e7
--- /dev/null
+++ b/others/volume1/003.scm
@@ -0,0 +1,8 @@
+(define n (read))
+(display (string-length (number->string n)))
+(display " ")
+(define (digitsum n) (if (> n 0)
+                         (+ (modulo n 10) (digitsum (quotient n 10)))
+                         0))
+(display (digitsum n))
+(newline)
diff --git a/others/volume1/006.scm b/others/volume1/006.scm
new file mode 100644
index 0000000..f791de2
--- /dev/null
+++ b/others/volume1/006.scm
@@ -0,0 +1,8 @@
+(display ((lambda (str from to)
+            (let ((i (string-index str (string->char-set from))))
+              (string-replace str to i (+ i (string-length from)))))
+          (number->string (let* ((a (read)) (b (read)) (c (read)) (d (read)))
+                            (+ (/ a b) (/ c d))))
+          "/"
+          " "))
+(newline)