結果
問題 | No.2017 Mod7 Parade |
ユーザー |
|
提出日時 | 2022-07-22 21:54:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 946 bytes |
コンパイル時間 | 2,771 ms |
コンパイル使用メモリ | 203,320 KB |
最終ジャッジ日時 | 2025-01-30 12:20:31 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef _RUTHEN #include "debug.hpp" #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template <class T> using V = vector<T>; #include <atcoder/modint> using mint = atcoder::modint1000000007; using mint2 = atcoder::modint; ostream &operator<<(ostream &os, const mint &p) { return os << p.val(); } int main() { ios::sync_with_stdio(false); cin.tie(0); mint2::set_mod(7); int K; cin >> K; V<ll> D(K), L(K); rep(i, K) cin >> D[i] >> L[i]; V<mint> dp(7, 0); dp[0] = 1; rep(i, K) { V<mint> np = dp; mint2 v = 10, p = 10; v = v.pow(L[i]); p = p.pow(L[i]); v--; v /= 9; v *= D[i]; rep(j, 7) np[(j * p + v).val()] += dp[j]; dp = np; } mint ans = 0; rep(j, 7) ans += dp[j] * j; cout << ans.val() << '\n'; return 0; }