結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,588 KB
testcase_01 AC 36 ms
53,588 KB
testcase_02 AC 35 ms
53,588 KB
testcase_03 AC 723 ms
76,024 KB
testcase_04 AC 677 ms
76,020 KB
testcase_05 AC 668 ms
76,024 KB
testcase_06 AC 698 ms
76,024 KB
testcase_07 AC 667 ms
76,024 KB
testcase_08 AC 668 ms
76,024 KB
testcase_09 AC 604 ms
76,024 KB
testcase_10 AC 643 ms
76,024 KB
testcase_11 AC 574 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, 9 * 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