結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
bluebery1001
|
| 提出日時 | 2023-11-03 21:39:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 16,384 KB |
| 最終ジャッジ日時 | 2024-09-25 19:40:58 |
| 合計ジャッジ時間 | 3,972 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 -- * 8 |
ソースコード
import math
t=int(input())
for i in range(t):
a,b,k = map(int,input().split())
lc = (a*b)//math.gcd(a,b)
ok = 0
ng = 20000000000000000000
while abs(ok-ng)>1:
mid = (ok+ng)//2
cna = mid//a
cnb = mid//b
cnab = mid//(lc)
if (mid-(cna+cnb-cnab)<=k):ok=mid
else:ng = mid
while ok%a==0 or ok%b==0:ok-=1
print(ok)
bluebery1001