結果

問題 No.2032 Let's Write Multiples!!
ユーザー 👑 tatyamtatyam
提出日時 2022-08-05 22:23:16
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 177 ms / 3,000 ms
コード長 593 bytes
コンパイル時間 2,703 ms
コンパイル使用メモリ 245,624 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 23:37:34
合計ジャッジ時間 6,687 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 54 ms
4,352 KB
testcase_02 AC 47 ms
4,348 KB
testcase_03 AC 44 ms
4,352 KB
testcase_04 AC 61 ms
4,348 KB
testcase_05 AC 153 ms
4,352 KB
testcase_06 AC 136 ms
4,352 KB
testcase_07 AC 60 ms
4,348 KB
testcase_08 AC 170 ms
4,348 KB
testcase_09 AC 41 ms
4,352 KB
testcase_10 AC 177 ms
4,348 KB
testcase_11 AC 174 ms
4,352 KB
testcase_12 AC 158 ms
4,348 KB
testcase_13 AC 159 ms
4,348 KB
testcase_14 AC 141 ms
4,348 KB
testcase_15 AC 61 ms
4,348 KB
testcase_16 AC 62 ms
4,348 KB
testcase_17 AC 62 ms
4,348 KB
testcase_18 AC 153 ms
4,348 KB
testcase_19 AC 77 ms
4,348 KB
testcase_20 AC 65 ms
4,352 KB
testcase_21 AC 52 ms
4,348 KB
testcase_22 AC 52 ms
4,348 KB
testcase_23 AC 52 ms
4,352 KB
testcase_24 AC 52 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/math>
using namespace std;
using ll = long long;


ll solve(){
    ll L, R, K, C;
    cin >> L >> R >> K >> C;
    R /= K;
    --L /= K;
    ll ans = 0;
    ll pow10 = 1;
    for(ll d = 0; d < 9; d++){
        ans += atcoder::floor_sum(R - L, pow10 * 10, K, (L + 1) * K - C * pow10);
        ans -= atcoder::floor_sum(R - L, pow10 * 10, K, (L + 1) * K - (C + 1) * pow10);
        pow10 *= 10;
    }
    return ans;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll T;
    cin >> T;
    while(T--) cout << solve() << '\n';
}
0