結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 KA37RIKA37RI
提出日時 2023-11-03 21:59:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 330 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 14,492 KB
最終ジャッジ日時 2023-11-03 21:59:17
合計ジャッジ時間 4,241 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from math import gcd
t = int(input())
for _ in range(t):
	ai, bi, ki = [int(x) for x in input().split()]
	li = ai // gcd(ai, bi) * bi
	left = 0
	right = li * ki
	while right - left > 1:
		mid = (right + left) // 2
		x = mid - (mid // ai) - (mid // bi) + (mid // li)
		if x >= ki:
			right = mid
		else:
			left = mid
	print(right)
0