結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-08-09 06:09:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 381 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 79,360 KB |
| 最終ジャッジ日時 | 2024-08-09 06:09:35 |
| 合計ジャッジ時間 | 14,620 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 TLE * 2 |
ソースコード
import math
def LCM(n,m):
if n or m:
return abs(n)*abs(m)//math.gcd(n,m)
return 0
def Bisect_Int(ok,ng,is_ok):
while abs(ok-ng)>1:
mid=(ok+ng)//2
if is_ok(mid):
ok=mid
else:
ng=mid
return ok
T=int(input())
for t in range(T):
A,B,K=map(int,input().split())
def is_ok(x):
return x-1-(x-1)//A-(x-1)//B+(x-1)//LCM(A,B)<K
ans=Bisect_Int(1,K*10,is_ok)
print(ans)
vwxyz