結果

問題 No.2526 Kth Not-divisible Number
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-02 00:47:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,024 KB
最終ジャッジ日時 2024-04-02 00:47:52
合計ジャッジ時間 7,478 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,588 KB
testcase_01 WA -
testcase_02 AC 39 ms
53,588 KB
testcase_03 AC 683 ms
76,024 KB
testcase_04 AC 653 ms
76,024 KB
testcase_05 AC 708 ms
76,024 KB
testcase_06 AC 662 ms
76,024 KB
testcase_07 AC 659 ms
76,024 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 565 ms
76,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
t = int(input())
for _ in range(t):
	a, b, k = map(int, input().split())
	l = math.lcm(a, b)
	lo, hi = 0, 2 * 10 ** 18
	while lo + 1 < hi:
		mid = (lo + hi) // 2
		cnt = mid - mid // a - mid // b + mid // l
		if cnt >= k:
			hi = mid
		else:
			lo = mid
	print(hi)
0