結果

問題 No.29 パワーアップ
ユーザー _Clay____
提出日時 2018-10-01 21:15:30
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 1,153 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-10-12 09:53:32
合計ジャッジ時間 1,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

(letrec* ((n (string->number (read-line)))
          (r (lambda (n a)
                     (if (zero? n)
                         (reverse a)
                         (r (- n 1) 
                            (cons (map string->number 
                                       (string-split (read-line) " "))
                                  a)))))
          (i (r n '()))
          (v (rlet1 v
                    (make-vector 10 0)
                    (for-each (lambda (x)
                                      (for-each (lambda (y)
                                                        (set! (~ v (- y 1)) 
                                                              (+ (~ v (- y 1)) 1)))
                                                x))
                              i))))
         (print 
           ((rec (c n q r) 
                 (if (negative? n)
                     (begin 
                        (+ (apply + q)
                           (quotient (apply + r) 4)))
                     (c (- n 1)
                        (cons (quotient (~ v n) 2) q)
                        (cons (remainder (~ v n) 2) r))))
            9 '() '())))
0