結果

問題 No.2032 Let's Write Multiples!!
ユーザー 👑 Nachia
提出日時 2022-08-05 21:32:35
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,034 bytes
コンパイル時間 2,577 ms
コンパイル使用メモリ 114,620 KB
最終ジャッジ日時 2025-01-30 17:44:31
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
#include <atcoder/math>

using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)


const i64 INF = 1001001001001001001;
using modint = atcoder::static_modint<998244353>;


int main(){
    int T; cin >> T;
    while(T --> 0){
        i64 L, R, K, C; cin >> L >> R >> K >> C;
        L = (L + K - 1) / K * K;
        if(L > R){ cout << "0\n"; continue; }
        i64 N = (R - L) / K + 1;
        i64 ans = 0;
        for(i64 d = 1; d <= 1'000'000'000; d *= 10){
            i64 s = atcoder::floor_sum(N, d*10, K, L+(9-C)*d);
            i64 t = atcoder::floor_sum(N, d*10, K, L+(10-C)*d);
            ans += t - s;
        }
        cout << ans << '\n';
    }
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;


0