結果
問題 | No.533 Mysterious Stairs |
ユーザー |
![]() |
提出日時 | 2018-06-08 23:07:32 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 59 ms / 5,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 1,500 ms |
コンパイル使用メモリ | 159,724 KB |
実行使用メモリ | 34,560 KB |
最終ジャッジ日時 | 2024-06-30 11:00:13 |
合計ジャッジ時間 | 2,637 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<bits/stdc++.h> #define all(vec) vec.begin(),vec.end() using namespace std; typedef long long int ll; typedef pair<int,int> P; const ll MOD=1000000007; const ll INF=1000000010; const ll LINF=4000000000000000010LL; const int MAX=310; const double EPS=1e-9; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; ll dp[1000010][4]; int main(){ int n;cin>>n; dp[0][0]=1; for(int i=0;i<=n;i++){ for(int j=1;j<=3;j++){ for(int k=0;k<=3;k++){ if(j==k)continue; (dp[i+j][j]+=dp[i][k])%=MOD; } } } cout<<(dp[n][1]+dp[n][2]+dp[n][3])%MOD<<endl; }