結果

問題 No.2526 Kth Not-divisible Number
ユーザー playerplayer
提出日時 2023-12-19 13:44:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 361 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,172 KB
最終ジャッジ日時 2023-12-19 13:44:14
合計ジャッジ時間 6,216 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from math import *

t = int(input())

for i in range(t):
    a,b,k = map(int,input().split())
    g = gcd(a,b)
    n = a//g*b
    right = 10**30
    left = 0
    while abs(right-left) > 1:
        mid = (right+left)//2
        if mid-(mid//a)-(mid//b)+(mid//n) >= k:
            right = mid
        else:
            left = mid
            
    print(right)    
0