結果

問題 No.432 占い(Easy)
ユーザー neko_the_shadow
提出日時 2016-10-16 21:53:36
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 20,864 KB
最終ジャッジ日時 2024-11-22 12:34:02
合計ジャッジ時間 3,406 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (digits x)
  (let loop ((n x) (ls '()))
    (if (< n 10)
      (cons n ls)
      (loop (quotient n 10) 
            (cons (modulo n 10) ls)))))

(define (f ls)
  (if (= 1 (length ls))
    (car ls)
    (f (map (lambda (x y) (+  (modulo   (+ x y) 10)
                              (quotient (+ x y) 10)))
            (cdr ls)
            ls))))

(define (input->list)
  (let loop ((line (read)) (ls '()))
    (if (eof-object? line)
      (cdr (reverse ls))
      (loop (read) (cons line ls)))))

(define (MAIN)
  (for-each
    (lambda (ans) (begin (display ans) (newline)))
    (map (lambda (x) (f (digits x))) (input->list))))

(MAIN)
0