結果
問題 |
No.533 Mysterious Stairs
|
ユーザー |
|
提出日時 | 2020-10-23 07:29:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 117 ms / 5,000 ms |
コード長 | 596 bytes |
コンパイル時間 | 1,893 ms |
コンパイル使用メモリ | 170,628 KB |
実行使用メモリ | 73,728 KB |
最終ジャッジ日時 | 2024-07-21 09:45:54 |
合計ジャッジ時間 | 4,911 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<bits/stdc++.h> #define INF 1000000007 using namespace std; int main(){ int n; cin >> n; vector<vector<long long>> dp(1000100,vector<long long>(4,0)); dp[0][0] = 1; for(int i=0;i < n;i++){ for(int j=0;j < 4;j++){ for(int k=1;k < 4;k++){ if(j != k){ dp[i+k][k] += dp[i][j] % INF; dp[i+k][k] %= INF; } } } } long long ans = 0; for(int i=0;i < 4;i++){ ans += dp[n][i] % INF; ans %= INF; } cout << ans << endl; return 0; }