結果
問題 |
No.222 引き算と足し算
|
ユーザー |
|
提出日時 | 2015-06-06 01:31:54 |
言語 | Scheme (Gauche-0.9.15) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 6,692 KB |
実行使用メモリ | 16,128 KB |
最終ジャッジ日時 | 2024-11-15 21:30:20 |
合計ジャッジ時間 | 2,546 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#!/usr/bin/env gosh (define (main args) (let* ([A (read-num)] [op (read-op)] [B (read-num)]) (print ((if (equal? op #\+) - +) A B))) 0) (define (read-op) (read-char)) (define (read-num) (define (d? c) (memq c (string->list "0123456789"))) (let loop ([res '()]) (let1 c (peek-char) (cond [(and (pair? res) (not (d? c))) (string->number (apply string (reverse! res)))] [else (read-char) (loop (cons c res))]))))