結果

問題 No.2526 Kth Not-divisible Number
ユーザー otamay6otamay6
提出日時 2023-11-04 13:33:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 614 ms
コンパイル使用メモリ 68,596 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-04 13:33:59
合計ジャッジ時間 6,160 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using ll = unsigned long long;

int main(void){
	int t;
	std::cin>>t;
	while(t--){
		ll a, b, k;
		std::cin>>a>>b>>k;
		ll l = 0, r = 4e18 + 100;
		while(l + 1 < r){
			ll m = (l+r) / 2;
			ll cnt = m - m/ a - m / b + m / (a*b);
			if(cnt >=k){
				r = m;
			}
			else{
				l = m;
			}
		}
		std::cout << r << std::endl;
	}
}
0