結果

問題 No.1811 EQUIV Ten
ユーザー SSRSSSRS
提出日時 2022-01-14 21:35:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 326 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 174,348 KB
実行使用メモリ 186,008 KB
最終ジャッジ日時 2024-04-30 13:10:22
合計ジャッジ時間 5,381 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,820 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 276 ms
155,080 KB
testcase_12 AC 294 ms
166,972 KB
testcase_13 AC 317 ms
181,500 KB
testcase_14 AC 326 ms
185,936 KB
testcase_15 AC 326 ms
186,008 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 3 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 17 ms
11,192 KB
testcase_21 AC 14 ms
10,496 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 113 ms
65,408 KB
testcase_24 AC 24 ms
15,360 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 91 ms
53,120 KB
testcase_27 AC 6 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 265 ms
150,804 KB
testcase_31 AC 10 ms
7,296 KB
testcase_32 AC 26 ms
16,768 KB
testcase_33 AC 28 ms
17,920 KB
testcase_34 AC 250 ms
142,992 KB
testcase_35 AC 89 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int N;
  cin >> N;
  vector<vector<vector<long long>>> dp(N + 1, vector<vector<long long>>(16, vector<long long>(2, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 16; j++){
      for (int k = 0; k < 2; k++){
        for (int l = 0; l < 2; l++){
          int j2 = (j * 2 + l) % 16;
          int k2 = k;
          if (j2 == 10){
            k2 = 1;
          }
          dp[i + 1][j2][k2] += dp[i][j][k];
          dp[i + 1][j2][k2] %= MOD;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 16; i++){
    ans += dp[N][i][1];
  }
  cout << ans % MOD << endl;
}
0