結果
問題 | No.533 Mysterious Stairs |
ユーザー |
|
提出日時 | 2022-11-25 16:21:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 536 ms / 5,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 82,132 KB |
実行使用メモリ | 258,176 KB |
最終ジャッジ日時 | 2024-10-01 23:35:35 |
合計ジャッジ時間 | 4,405 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
MOD = int(1e9+7)def main():N = int(input())dp_table = [[0, 0, 0, 0] for _ in range(N+1)]dp_table[0][0] = 1dp_table[0].append(sum(dp_table[0]) % MOD)for stair in range(1, N+1):for up_stair in range(1, min(stair+1, 4)):dp_table[stair][up_stair] = dp_table[stair-up_stair][4] - \dp_table[stair-up_stair][up_stair]dp_table[stair].append(sum(dp_table[stair]) % MOD)print(dp_table[N][4])if __name__ == "__main__":main()