結果

問題 No.593 4進FizzBuzz
ユーザー ducktailducktail
提出日時 2017-12-30 20:27:03
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 5,384 KB
実行使用メモリ 116,948 KB
最終ジャッジ日時 2023-08-23 11:07:43
合計ジャッジ時間 13,459 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
11,712 KB
testcase_01 AC 20 ms
11,832 KB
testcase_02 AC 19 ms
11,712 KB
testcase_03 AC 19 ms
11,824 KB
testcase_04 AC 19 ms
11,692 KB
testcase_05 AC 18 ms
11,804 KB
testcase_06 AC 18 ms
11,836 KB
testcase_07 AC 18 ms
11,608 KB
testcase_08 AC 18 ms
11,596 KB
testcase_09 AC 18 ms
11,688 KB
testcase_10 AC 18 ms
11,708 KB
testcase_11 AC 18 ms
11,720 KB
testcase_12 AC 18 ms
11,708 KB
testcase_13 AC 18 ms
11,684 KB
testcase_14 AC 18 ms
11,612 KB
testcase_15 AC 18 ms
11,820 KB
testcase_16 AC 471 ms
115,748 KB
testcase_17 AC 468 ms
116,528 KB
testcase_18 AC 469 ms
116,948 KB
testcase_19 AC 469 ms
116,124 KB
testcase_20 AC 466 ms
116,064 KB
testcase_21 AC 471 ms
115,380 KB
testcase_22 AC 473 ms
116,836 KB
testcase_23 AC 468 ms
115,692 KB
testcase_24 AC 474 ms
115,704 KB
testcase_25 AC 470 ms
115,856 KB
testcase_26 AC 472 ms
116,192 KB
testcase_27 AC 470 ms
116,012 KB
testcase_28 AC 468 ms
115,488 KB
testcase_29 AC 467 ms
115,744 KB
testcase_30 AC 467 ms
115,644 KB
testcase_31 AC 469 ms
115,980 KB
testcase_32 AC 470 ms
115,768 KB
testcase_33 AC 470 ms
115,860 KB
testcase_34 AC 468 ms
115,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (classify ls)
  (let loop ([a 0]
             [b 0]
             [ls ls])
    (cond [(null? ls) (values a b)]
          [(null? (cdr ls)) (values b (+ a (car ls)))]
          [else (loop (+ a (car ls)) (+ b (cadr ls)) (cddr ls))])))

(define (main args)
  (let* ([s (read-line)]
         [ls (map digit->integer (string->list s))])
    (receive (o e) (classify ls)
             (print
              (cond [(and (zero? (modulo (+ o e) 3)) (zero? (modulo (- e o) 5))) "FizzBuzz"]
                    [(zero? (modulo (+ o e) 3)) "Fizz"]
                    [(zero? (modulo (- e o) 5)) "Buzz"]
                    [else s]))))
  0)
0