結果

問題 No.533 Mysterious Stairs
ユーザー letrangerjpletrangerjp
提出日時 2017-06-24 07:35:07
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 306 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 814,592 KB
最終ジャッジ日時 2024-04-14 23:34:53
合計ジャッジ時間 9,311 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
12,288 KB
testcase_01 RE -
testcase_02 AC 76 ms
12,160 KB
testcase_03 AC 77 ms
12,288 KB
testcase_04 RE -
testcase_05 AC 77 ms
12,160 KB
testcase_06 AC 76 ms
12,288 KB
testcase_07 RE -
testcase_08 AC 76 ms
12,416 KB
testcase_09 AC 75 ms
12,288 KB
testcase_10 RE -
testcase_11 AC 77 ms
12,544 KB
testcase_12 RE -
testcase_13 AC 79 ms
12,928 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 97 ms
16,768 KB
testcase_18 AC 108 ms
19,072 KB
testcase_19 AC 116 ms
20,864 KB
testcase_20 AC 774 ms
113,792 KB
testcase_21 AC 747 ms
126,464 KB
testcase_22 AC 2,304 ms
365,568 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