結果
問題 |
No.1811 EQUIV Ten
|
ユーザー |
![]() |
提出日時 | 2024-04-02 14:08:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 2,303 ms |
コンパイル使用メモリ | 198,256 KB |
最終ジャッジ日時 | 2025-02-20 19:39:14 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#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; }