結果
| 問題 |
No.533 Mysterious Stairs
|
| コンテスト | |
| ユーザー |
oxyshower
|
| 提出日時 | 2019-12-01 17:07:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 5,000 ms |
| コード長 | 547 bytes |
| コンパイル時間 | 1,489 ms |
| コンパイル使用メモリ | 167,156 KB |
| 実行使用メモリ | 26,880 KB |
| 最終ジャッジ日時 | 2024-11-21 11:52:17 |
| 合計ジャッジ時間 | 2,712 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;
signed main(){
int n; cin >> n;
static int dp[1000011][3];
dp[1][0] = 1, dp[2][1] = 1, dp[3][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) continue;
dp[i+k+1][k] = (dp[i+k+1][k] + dp[i][j]) % MOD;
}
}
}
int ans = (dp[n][0] + dp[n][1] + dp[n][2]) % MOD;
cout << ans << endl;
return 0;
}
oxyshower