結果

問題 No.533 Mysterious Stairs
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-11 17:15:40
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 252 ms / 5,000 ms
コード長 552 bytes
コンパイル時間 2,058 ms
コンパイル使用メモリ 152,360 KB
実行使用メモリ 112,748 KB
最終ジャッジ日時 2023-10-14 18:25:55
合計ジャッジ時間 4,467 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 3 ms
4,420 KB
testcase_18 AC 4 ms
4,828 KB
testcase_19 AC 4 ms
4,828 KB
testcase_20 AC 30 ms
15,616 KB
testcase_21 AC 32 ms
16,932 KB
testcase_22 AC 96 ms
45,616 KB
testcase_23 AC 249 ms
111,420 KB
testcase_24 AC 252 ms
112,748 KB
testcase_25 AC 30 ms
15,784 KB
testcase_26 AC 217 ms
97,664 KB
testcase_27 AC 65 ms
31,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	const mod: int :: 1000000007
	var n: int :: cui@inputInt()
	; dp[i][j] = val
	; i: 昇ったステップ
	; j: 最後のステップ
	; val: 通り数
	var dp: [][]int :: #[n + 1, 4]int
	do dp[0][0] :: 1
	for i(0, n - 1)
		for j(0, 3)
			for k(1, 3)
				if(j = k)
					skip k
				end if
				if(dp[i][j] <> 0 & i + k <= n)
					do dp[i + k][k] :+ dp[i][j]
					do dp[i + k][k] :% mod
				end if
			end for
		end for
	end for
	
	var ans: int :: 0
	for j(1, 3)
		do ans :+ dp[n][j]
		do ans :% mod
	end for
	do cui@print("\{ans}\n")
end func
0