結果

問題 No.2526 Kth Not-divisible Number
ユーザー lemondolemondo
提出日時 2023-11-03 21:58:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 83,788 KB
最終ジャッジ日時 2023-11-03 21:59:19
合計ジャッジ時間 20,445 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,756 KB
testcase_01 AC 37 ms
53,756 KB
testcase_02 AC 36 ms
53,756 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 AC 1,852 ms
83,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

from math import gcd
T = int(input())
for _ in range(T):
    A, B, K = mapint()
    lc = A*B//gcd(A, B)
    l = 0
    r = 10**18 * 20
    while l+1<r:
        tar = (l+r)//2
        cnt = tar - tar//A - tar//B + tar//lc
        if(cnt >= K):
            r = tar
        else:
            l = tar
    print(r)

0