結果
問題 |
No.533 Mysterious Stairs
|
ユーザー |
![]() |
提出日時 | 2021-03-21 17:41:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 5,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 1,671 ms |
コンパイル使用メモリ | 170,700 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 11:40:39 |
合計ジャッジ時間 | 2,544 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<vector<long long>> temp(3,vector<long long>(4,0)); long long MOD=pow(10,9)+7; temp[0][3]=1; temp[0][2]=1; for(int i=0;i<N-1;i++){ for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ temp[k][j]=temp[k][j+1]; } } for(int j=1;j<=3;j++){ temp[j-1][3]=(temp[0][3-j]+temp[1][3-j]+temp[2][3-j]-temp[j-1][3-j])%MOD; } } cout<<(temp[0][3]+temp[1][3]+temp[2][3])%MOD<<endl; }