結果

問題 No.2526 Kth Not-divisible Number
ユーザー hato336
提出日時 2023-11-03 21:35:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 460 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,944 KB
実行使用メモリ 97,024 KB
最終ジャッジ日時 2024-09-25 19:33:04
合計ジャッジ時間 22,446 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def solve():
    a,b,k = map(int,input().split())
    c = a*b//math.gcd(a,b)
    l,r = 0,10**20
    while r-l > 1:
        m = (l+r)//2
        cnt = m // a + m // b - m // c
        if m - cnt >= k:
            r = m
        else:
            l = m
    print(r)

for _ in range(int(input())):
    solve()
0