結果

問題 No.314 ケンケンパ
ユーザー maimai
提出日時 2016-02-02 20:20:04
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 188 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 18,872 KB
最終ジャッジ日時 2023-10-21 18:43:56
合計ジャッジ時間 2,895 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 86 ms
15,992 KB
testcase_02 AC 86 ms
15,992 KB
testcase_03 AC 85 ms
15,992 KB
testcase_04 AC 86 ms
15,992 KB
testcase_05 AC 86 ms
15,992 KB
testcase_06 AC 86 ms
15,992 KB
testcase_07 AC 87 ms
15,992 KB
testcase_08 AC 86 ms
15,992 KB
testcase_09 AC 87 ms
15,992 KB
testcase_10 AC 86 ms
15,992 KB
testcase_11 AC 86 ms
15,992 KB
testcase_12 AC 86 ms
15,984 KB
testcase_13 AC 86 ms
15,992 KB
testcase_14 AC 90 ms
16,516 KB
testcase_15 AC 92 ms
17,044 KB
testcase_16 AC 100 ms
18,100 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

@lim=(7+1e9).to_i

@memo={}
def calc(x)
    return 1 if x<=1
    return 2 if x==2
    @memo[x]=(calc(x-3)%@lim+calc(x-2)%@lim)%@lim if !@memo[x]
    return @memo[x]
end

p calc(gets.to_i)
0