結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-03 23:50:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 334 bytes |
| コンパイル時間 | 273 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 78,080 KB |
| 最終ジャッジ日時 | 2024-09-25 21:37:46 |
| 合計ジャッジ時間 | 20,871 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 TLE * 8 |
ソースコード
from math import gcd
def is_ok(md):
cnt = md - md//A - md//B + md//L
return cnt >= K
def bis(ok, ng):
while abs(ok - ng) > 1:
md = (ng + ok) // 2
if is_ok(md): ok = md
else: ng = md
return ok
T = int(input())
for _ in range(T):
A, B, K = map(int, input().split())
L = A // gcd(A, B) * B
print(bis(10**19, 0))