結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー neko_the_shadowneko_the_shadow
提出日時 2016-11-20 18:28:09
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 31 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 14,268 KB
最終ジャッジ日時 2023-08-18 05:51:53
合計ジャッジ時間 1,657 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
12,364 KB
testcase_01 AC 23 ms
12,260 KB
testcase_02 AC 22 ms
12,272 KB
testcase_03 AC 21 ms
14,268 KB
testcase_04 AC 21 ms
12,272 KB
testcase_05 AC 23 ms
12,396 KB
testcase_06 AC 23 ms
12,300 KB
testcase_07 AC 22 ms
12,292 KB
testcase_08 AC 23 ms
12,264 KB
testcase_09 AC 21 ms
12,256 KB
testcase_10 AC 23 ms
12,352 KB
testcase_11 AC 21 ms
12,264 KB
testcase_12 AC 23 ms
12,416 KB
testcase_13 AC 23 ms
12,380 KB
testcase_14 AC 20 ms
12,360 KB
testcase_15 AC 21 ms
12,416 KB
testcase_16 AC 23 ms
12,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(use srfi-13)
(use srfi-14)

(define (validate-integer? token)
  (let ((ls (string->list token)))
    (or (and (equal? #\0 (car ls)) (= 1 (length ls)))
        (and (not (equal? #\0 (car ls)))
             (every (cut char-set-contains? char-set:digit <>) ls)))))

(define (validate? token)
  (and (validate-integer? token)
        (let ((x (string->number token)))
          (and (<= 0 x) (<= x 12345)))))

(define (Main)
  (let ((a (read-line)) (b (read-line)))
    (display (if (every validate? (list a b)) "OK" "NG"))
    (newline)))

(Main)
0