結果

問題 No.2032 Let's Write Multiples!!
ユーザー 沙耶花沙耶花
提出日時 2022-08-06 00:21:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 431 ms / 3,000 ms
コード長 644 bytes
コンパイル時間 5,948 ms
コンパイル使用メモリ 258,512 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 02:40:37
合計ジャッジ時間 12,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 209 ms
4,348 KB
testcase_02 AC 177 ms
4,348 KB
testcase_03 AC 164 ms
4,348 KB
testcase_04 AC 261 ms
4,348 KB
testcase_05 AC 430 ms
4,352 KB
testcase_06 AC 388 ms
4,352 KB
testcase_07 AC 218 ms
4,352 KB
testcase_08 AC 306 ms
4,348 KB
testcase_09 AC 417 ms
4,348 KB
testcase_10 AC 314 ms
4,352 KB
testcase_11 AC 315 ms
4,348 KB
testcase_12 AC 289 ms
4,352 KB
testcase_13 AC 290 ms
4,348 KB
testcase_14 AC 273 ms
4,348 KB
testcase_15 AC 259 ms
4,352 KB
testcase_16 AC 260 ms
4,348 KB
testcase_17 AC 259 ms
4,352 KB
testcase_18 AC 431 ms
4,348 KB
testcase_19 AC 249 ms
4,352 KB
testcase_20 AC 186 ms
4,352 KB
testcase_21 AC 209 ms
4,352 KB
testcase_22 AC 207 ms
4,352 KB
testcase_23 AC 208 ms
4,352 KB
testcase_24 AC 208 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

long long get(long long N,long long K,long long C){
	long long cur = 1;
	long long ret = 0;
	rep(i,9){
		long long a = 0;
		a -= cur * C;
		ret += floor_sum(N/K+1,cur*10,K,a);
		a -= cur;
		ret -= floor_sum(N/K+1,cur*10,K,a);
		cur *= 10;
		//break;
	}
	
	return ret;
	
}

int main() {
    
	int _t;
	cin>>_t;
	
	rep(_,_t){
		long long L,R,K,C;
		cin>>L>>R>>K>>C;
		
		cout<<get(R,K,C) - get(L-1,K,C)<<endl;
	}
	
	
    return 0;
}
0