結果
問題 | No.279 木の数え上げ |
ユーザー |
![]() |
提出日時 | 2015-09-22 04:24:32 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 311 ms / 2,000 ms |
コード長 | 1,055 bytes |
コンパイル時間 | 54 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 34,728 KB |
最終ジャッジ日時 | 2024-10-14 15:13:08 |
合計ジャッジ時間 | 4,373 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#!/usr/bin/env gosh (define (hoge) (let ((input (read-line))) (display (count-tree input)) (newline))) (define (count-tree str) (let ((char-list (string->list str)) (count-char-lambdas (list (count-char #\t) (count-char #\r) (div2 (count-char #\e))))) (define (apply-lambdas lst arg) (if (equal? '() lst) lst (cons ((car lst) arg) (apply-lambdas (cdr lst) arg)))) (minimum (apply-lambdas count-char-lambdas char-list)))) (define (minimum lst) (define (iter lst holder) (if (null? lst) holder (if (< holder (car lst)) (iter (cdr lst) holder) (iter (cdr lst) (car lst))))) (iter (cdr lst) (car lst))) (define (div2 f) (lambda (x) (div (f x) 2))) (define (count-char char) (lambda (x) (define (iter x i) (if (equal? x '()) i (if (equal? (car x) char) (iter (cdr x) (+ i 1)) (iter (cdr x) i)))) (iter x 0))) (hoge)