結果
問題 | No.533 Mysterious Stairs |
ユーザー |
![]() |
提出日時 | 2018-10-17 06:39:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 678 ms |
コンパイル使用メモリ | 90,568 KB |
実行使用メモリ | 34,688 KB |
最終ジャッジ日時 | 2024-10-12 18:50:40 |
合計ジャッジ時間 | 2,534 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <random> using namespace std; typedef long long int ll; typedef pair<int, int> P; const ll MOD=1e9+7; int main() { int n; cin>>n; ll dp[1000001][4]={}; dp[0][0]=1; for(int i=1; i<=n; i++){ for(int j=1; j<=3; j++){ if(i<j) continue; for(int k=0; k<=3; k++){ if(j==k) continue; dp[i][j]+=dp[i-j][k]; } dp[i][j]%=MOD; } } cout<<(dp[n][1]+dp[n][2]+dp[n][3])%MOD<<endl; return 0; }