結果

問題 No.314 ケンケンパ
ユーザー wotsushiwotsushi
提出日時 2017-01-26 21:21:56
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 227 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 11,444 KB
実行使用メモリ 18,292 KB
最終ジャッジ日時 2023-08-25 00:06:25
合計ジャッジ時間 2,960 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 78 ms
15,076 KB
testcase_02 AC 79 ms
15,228 KB
testcase_03 AC 78 ms
15,088 KB
testcase_04 AC 78 ms
15,324 KB
testcase_05 AC 78 ms
15,216 KB
testcase_06 AC 78 ms
15,012 KB
testcase_07 AC 79 ms
15,084 KB
testcase_08 AC 80 ms
15,256 KB
testcase_09 AC 78 ms
15,072 KB
testcase_10 AC 79 ms
15,260 KB
testcase_11 AC 79 ms
15,120 KB
testcase_12 AC 80 ms
15,088 KB
testcase_13 AC 79 ms
15,092 KB
testcase_14 AC 84 ms
16,136 KB
testcase_15 AC 89 ms
18,292 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
def f(n)
  @dp ||= {}
  @dp[n] ||= if n <= 1
               1
             elsif n == 2
               2
             else
               f(n - 2) + f(n - 3)
             end
end
ans = f(N) % (10**9 + 7)
puts ans
0