結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-08-09 06:09:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 17,696 KB |
| 最終ジャッジ日時 | 2024-08-09 06:09:12 |
| 合計ジャッジ時間 | 5,492 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 -- * 8 |
ソースコード
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