結果

問題 No.533 Mysterious Stairs
ユーザー cielciel
提出日時 2017-06-25 17:33:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 183 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 36,768 KB
最終ジャッジ日時 2024-04-14 23:42:27
合計ジャッジ時間 4,796 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 89 ms
12,160 KB
testcase_03 AC 92 ms
12,288 KB
testcase_04 AC 90 ms
12,288 KB
testcase_05 AC 88 ms
12,160 KB
testcase_06 AC 90 ms
12,160 KB
testcase_07 AC 90 ms
12,160 KB
testcase_08 AC 89 ms
12,160 KB
testcase_09 AC 89 ms
12,288 KB
testcase_10 AC 89 ms
12,160 KB
testcase_11 AC 89 ms
12,288 KB
testcase_12 AC 88 ms
12,160 KB
testcase_13 AC 87 ms
12,160 KB
testcase_14 AC 89 ms
12,160 KB
testcase_15 AC 89 ms
12,160 KB
testcase_16 AC 89 ms
12,032 KB
testcase_17 AC 90 ms
12,160 KB
testcase_18 AC 92 ms
12,416 KB
testcase_19 AC 92 ms
12,288 KB
testcase_20 AC 129 ms
16,256 KB
testcase_21 AC 133 ms
17,024 KB
testcase_22 AC 222 ms
23,680 KB
testcase_23 AC 438 ms
36,408 KB
testcase_24 AC 447 ms
36,768 KB
testcase_25 AC 127 ms
15,744 KB
testcase_26 AC 393 ms
33,592 KB
testcase_27 AC 177 ms
21,504 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
M=10**9+7
a=[0,1,0,1]
b=[0,0,1,1]
c=[0,0,0,1]
(4..gets.to_i).each{|i|
	a[i]=(b[i-1]+c[i-1])%M
	b[i]=(a[i-2]+c[i-2])%M
	c[i]=(a[i-3]+b[i-3])%M
}
p (a[-1]+b[-1]+c[-1])%M
0