結果

問題 No.1049 Zero (Exhaust)
ユーザー koya_bot2koya_bot2
提出日時 2020-05-25 21:08:03
言語 Ruby
(3.3.0)
結果
MLE  
実行時間 -
コード長 236 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 820,992 KB
最終ジャッジ日時 2024-04-21 03:52:26
合計ジャッジ時間 3,315 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
12,160 KB
testcase_01 AC 86 ms
12,416 KB
testcase_02 AC 85 ms
12,160 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# coding : utf-8

P, K = gets.split(' ').map{|s|s.to_i}

a = Array.new(K+1)
b = Array.new(K+1)

a[0] = 1
b[0] = 0

K.times do |i|
  a[i+1] = (P+1) * a[i] + 2 * b[i]
  b[i+1] = (P-1) * a[i] + 2 * (P-1) * b[i]
end

p a[K] % 1_000_000_007
0