結果

問題 No.2526 Kth Not-divisible Number
ユーザー hiro1729hiro1729
提出日時 2023-11-03 21:36:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 76,124 KB
最終ジャッジ日時 2023-11-03 21:36:35
合計ジャッジ時間 8,143 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,684 KB
testcase_01 WA -
testcase_02 AC 36 ms
53,684 KB
testcase_03 AC 737 ms
76,120 KB
testcase_04 AC 682 ms
76,124 KB
testcase_05 AC 704 ms
76,124 KB
testcase_06 AC 709 ms
76,116 KB
testcase_07 AC 684 ms
76,124 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
for _ in range(int(input())):
	a, b, k = map(int, input().split())
	g = gcd(a, b)
	l = a // g * b
	le = 1
	ri = 1 << 63
	while le + 1 < ri:
		mi = (le + ri) // 2
		if mi - ((mi // a) + (mi // b) - (mi // l)) > k:
			ri = mi
		else:
			le = mi
	print(le)
0