結果
| 問題 |
No.533 Mysterious Stairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-23 22:42:19 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 209 ms / 5,000 ms |
| コード長 | 669 bytes |
| コンパイル時間 | 1,090 ms |
| コンパイル使用メモリ | 113,528 KB |
| 実行使用メモリ | 67,616 KB |
| 最終ジャッジ日時 | 2024-06-12 20:29:18 |
| 合計ジャッジ時間 | 2,805 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
immutable long MOD = 10^^9 + 7;
void main() {
auto N = readln.chomp.to!int;
auto dp = new long[][](N+1, 4);
dp[0][0] = 1;
foreach (i; 1..N+1) {
foreach (j; 0..4) {
foreach (k; 0..4) {
if (k == 0) continue;
if (j == k) continue;
if (i-k < 0) continue;
(dp[i][k] += dp[i-k][j]) %= MOD;
}
}
}
writeln((dp[N][1] + dp[N][2] + dp[N][3]) % MOD);
}