結果

問題 No.533 Mysterious Stairs
ユーザー cureskolcureskol
提出日時 2022-12-21 15:08:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 206,312 KB
実行使用メモリ 57,984 KB
最終ジャッジ日時 2024-04-29 03:20:20
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 14 ms
9,216 KB
testcase_21 AC 15 ms
9,856 KB
testcase_22 AC 44 ms
24,192 KB
testcase_23 AC 110 ms
57,216 KB
testcase_24 AC 111 ms
57,984 KB
testcase_25 AC 14 ms
9,344 KB
testcase_26 AC 97 ms
50,304 KB
testcase_27 AC 29 ms
17,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

#include <atcoder/modint>
using namespace atcoder;
using mint=modint1000000007;
ostream& operator<<(ostream &os,mint a){os<<a.val();return os;}
istream& operator>>(istream &is,mint &a){
  long long b;is>>b;a=b;
  return is;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;cin>>n;
  vector dp(n+1,vector<mint>(4,0));
  dp[0][0]=1;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=3;j++)
      REP(k,4)
        if(i-j>=0 and j!=k)
          dp[i][j]+=dp[i-j][k];
  mint ans=0;
  REP(k,4)ans+=dp[n][k];
  cout<<ans<<endl;
}
0