結果
| 問題 |
No.533 Mysterious Stairs
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2019-04-30 02:03:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,110 bytes |
| コンパイル時間 | 1,621 ms |
| コンパイル使用メモリ | 76,436 KB |
| 実行使用メモリ | 57,856 KB |
| 最終ジャッジ日時 | 2024-12-26 00:13:02 |
| 合計ジャッジ時間 | 3,884 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 3 RE * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define P pair<int, int>
#define MOD 1000000007
#define INF 1012345678
#define NINF (-2147483647-1)
#define LLINF 9223372036854775807
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
// dp[i][j] := i+1段目にいて前回j+1stepjumpした
vector<vector<int>> dp(N, vector<int>(3, 0));
dp[0][0] = dp[1][1] = dp[2][2] = 1;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
if (j != k && i + k + 1 < N) {
dp[i + k + 1][k] += dp[i][j];
dp[i + k + 1][k] %= MOD;
}
}
}
}
cout << (dp[N - 1][0] + dp[N - 1][1] + dp[N - 1][2]) % MOD << endl;
getchar(); getchar();
}
🍮かんプリン