結果
問題 | No.2032 Let's Write Multiples!! |
ユーザー | Shirotsume |
提出日時 | 2022-07-14 02:55:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 423 ms / 3,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 4,118 ms |
コンパイル使用メモリ | 250,936 KB |
最終ジャッジ日時 | 2025-01-30 06:55:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using mint = modint998244353; using ll = long long; #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < n; i++) ll f(ll r, ll k, ll c){ ll n = r / k; ll ans = 0; ll d = 1; for(int i = 0; i < 9; i++){ ll x = c * d; ll y = (c + 1) * d; d *= 10; ans += floor_sum(n, d, k, d + k - x) - floor_sum(n, d, k, d + k - y); } return ans; } ll solve(){ ll l, r, k, c; cin >> l >> r >> k >> c; return f(r, k, c) - f(l - 1, k, c); } int main(void) { int t; cin >> t; rep(i, t){ cout << solve() << endl; } return 0; }