結果

問題 No.639 An Ordinary Sequence
ユーザー ducktailducktail
提出日時 2018-01-26 23:32:52
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 20 ms / 1,000 ms
コード長 361 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 5,372 KB
実行使用メモリ 11,892 KB
最終ジャッジ日時 2023-08-30 12:50:00
合計ジャッジ時間 1,859 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,696 KB
testcase_01 AC 19 ms
11,692 KB
testcase_02 AC 19 ms
11,680 KB
testcase_03 AC 18 ms
11,832 KB
testcase_04 AC 18 ms
11,832 KB
testcase_05 AC 18 ms
11,800 KB
testcase_06 AC 19 ms
11,828 KB
testcase_07 AC 18 ms
11,672 KB
testcase_08 AC 19 ms
11,828 KB
testcase_09 AC 18 ms
11,696 KB
testcase_10 AC 18 ms
11,848 KB
testcase_11 AC 18 ms
11,848 KB
testcase_12 AC 18 ms
11,704 KB
testcase_13 AC 19 ms
11,892 KB
testcase_14 AC 18 ms
11,688 KB
testcase_15 AC 18 ms
11,748 KB
testcase_16 AC 20 ms
11,804 KB
testcase_17 AC 19 ms
11,856 KB
testcase_18 AC 19 ms
11,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (main args)
  (let ([n (read)]
        [tbl (make-hash-table)])
    (define (seq x)
      (cond [(zero? x) 1]
            [(hash-table-exists? tbl x) (hash-table-get tbl x)]
            [else (let ([y (+ (seq (quotient x 3)) (seq (quotient x 5)))])
                    (hash-table-put! tbl x y)
                    y)]))
    (print (seq n))
    )
  0)
0