結果

問題 No.533 Mysterious Stairs
ユーザー letrangerjpletrangerjp
提出日時 2017-06-24 07:35:07
言語 Ruby
(3.2.2)
結果
RE  
実行時間 -
コード長 306 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 809,276 KB
最終ジャッジ日時 2023-07-27 11:14:05
合計ジャッジ時間 14,583 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,140 KB
testcase_01 RE -
testcase_02 AC 82 ms
15,128 KB
testcase_03 AC 80 ms
15,320 KB
testcase_04 RE -
testcase_05 AC 82 ms
15,036 KB
testcase_06 AC 83 ms
15,148 KB
testcase_07 RE -
testcase_08 AC 80 ms
15,184 KB
testcase_09 AC 81 ms
15,268 KB
testcase_10 RE -
testcase_11 AC 87 ms
15,388 KB
testcase_12 RE -
testcase_13 AC 86 ms
16,080 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 107 ms
20,304 KB
testcase_18 AC 125 ms
23,072 KB
testcase_19 AC 140 ms
25,276 KB
testcase_20 AC 921 ms
128,144 KB
testcase_21 AC 1,087 ms
139,588 KB
testcase_22 AC 3,037 ms
409,348 KB
testcase_23 MLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(n, i, level=0)
  $*[-~n*8+i] ||= if n == 0
    1
  elsif n < 0
    0
  else
    [1,2,3].map{|j|
      if j == i
       0
      elsif level > 200
        Fiber.new { f(n - j, j, 0) }.resume
      else
        f(n - j, j, level+1)
      end
    }.sum % M
  end
end

M = 10**9+7
N = gets.to_i
p f(N, 0)
0