結果
問題 | No.2032 Let's Write Multiples!! |
ユーザー |
![]() |
提出日時 | 2022-08-16 07:10:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 895 ms |
コンパイル使用メモリ | 77,608 KB |
最終ジャッジ日時 | 2025-01-30 23:06:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 24 |
ソースコード
#include <iostream>#include <atcoder/math>using namespace std;using namespace atcoder;typedef long long ll;ll solve(ll l,ll r,ll k,ll d,ll x){//count [l,r)*k mod d >=xll c1 = floor_sum(r,d,k,0) - floor_sum(l,d,k,0);ll c2 = floor_sum(r,d,k,d - x) - floor_sum(l,d,k,d - x) - (r - l);return (r - l) - (c1 - c2);}int main(){ios_base::sync_with_stdio(false);cin.tie(NULL);int t; cin >> t;while(t){t--;ll l,r,k,c; cin >> l >> r >> k >> c;ll le = (l + k - 1)/k,ri = r/k + 1;ll i,ans = 0,now = 1;for(i=0;i<10;i++){ans += solve(le,ri,k,now*10,now*c) - solve(le,ri,k,now*10,now*(c + 1));now *= 10;}cout << ans << "\n";}}