結果

問題 No.2526 Kth Not-divisible Number
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-11-03 21:52:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 78,964 KB
最終ジャッジ日時 2023-11-03 21:53:10
合計ジャッジ時間 26,628 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,736 KB
testcase_01 WA -
testcase_02 AC 37 ms
53,736 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
def solve():

    a,b,k = map(int,input().split())
    ab = a*b//(gcd(a,b))
    l = k-1
    r = 10**22

    while r - l > 1:

        m = (r+l)//2

        num = m

        num -= m//a + m//b
        num += m//ab

        if num > k:
            r = m
        else:
            l = m

    return l

t = int(input())
for _ in range(t):
    print(solve())
0