結果

問題 No.2526 Kth Not-divisible Number
ユーザー nikoro256
提出日時 2023-11-03 21:47:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 354 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 78,612 KB
最終ジャッジ日時 2024-09-25 19:56:44
合計ジャッジ時間 24,678 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def isok(n):
    ans=n-n//A-n//B+n//math.lcm(A,B)
    if ans<K:
        return True
    return False

T=int(input())
for _ in range(T):
    A,B,K=map(int,input().split())
    left,right=0,10**20
    while right-left>1:
        mid=(right+left)//2
        if isok(mid):
            left=mid
        else:
            right=mid
    print(right)
0