結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-08 04:53:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 966 ms / 2,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 347 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 77,440 KB |
| 最終ジャッジ日時 | 2024-09-25 23:36:48 |
| 合計ジャッジ時間 | 8,941 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
ソースコード
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.buffer.readline
# sys.maxsize = (1<<64) - 1
def answer():
A,B,K = map(int,input().split())
def is_ok(x):
tmp = (x//A) + (x//B) - (x//(A*B//math.gcd(A,B)))
return x-tmp >= K
y = min((1<<62),K*A*B)
x = K-1
while y-x>1:
mid = (y+x)//2
if is_ok(mid):
y = mid
else:
x = mid
print(y)
for _ in range(int(input())):
answer()