結果

問題 No.1811 EQUIV Ten
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-02 14:08:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 3,135 ms
コンパイル使用メモリ 207,960 KB
実行使用メモリ 23,580 KB
最終ジャッジ日時 2024-04-02 14:08:39
合計ジャッジ時間 4,293 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 30 ms
20,148 KB
testcase_12 AC 32 ms
21,464 KB
testcase_13 AC 35 ms
23,076 KB
testcase_14 AC 37 ms
23,580 KB
testcase_15 AC 36 ms
23,580 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 4 ms
6,676 KB
testcase_21 AC 3 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 13 ms
10,112 KB
testcase_24 AC 4 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 11 ms
8,832 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 2 ms
6,676 KB
testcase_30 AC 30 ms
19,664 KB
testcase_31 AC 2 ms
6,676 KB
testcase_32 AC 4 ms
6,676 KB
testcase_33 AC 5 ms
6,676 KB
testcase_34 AC 29 ms
18,796 KB
testcase_35 AC 11 ms
8,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint1000000007;

void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int n;
    cin >> n;
    vector<vector<mint>> dp(n + 1, vector<mint>(16, 0));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 16; j++) {
            dp[i + 1][2 * j % 16] += dp[i][j];
            dp[i + 1][(2 * j + 1) % 16] += dp[i][j];
        }
        dp[i + 1][10] = 0;
    }
    mint ans = mint(2).pow(n);
    for (int j = 0; j < 16; j++) {
        ans -= dp[n][j];
    }
    cout << ans.val() << endl;
}
0