結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-03 22:27:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 289 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 82,944 KB |
| 実行使用メモリ | 78,208 KB |
| 最終ジャッジ日時 | 2024-09-25 20:52:17 |
| 合計ジャッジ時間 | 22,223 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 9 |
ソースコード
from math import*
t=int(input())
def judge(x,a,b,l,k):
x+=x//l-x//a-x//b
return k<=x
for _ in range(t):
a,b,k=map(int,input().split())
l=a*b//gcd(a,b)
ok,ng=10**20,0
while abs(ok-ng)>1:
mid=ok+ng>>1
if judge(mid,a,b,l,k):
ok=mid
else:
ng=mid
print(ok)