結果

問題 No.2526 Kth Not-divisible Number
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-08 04:41:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 528 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 81,484 KB
実行使用メモリ 81,356 KB
最終ジャッジ日時 2023-11-08 04:41:21
合計ジャッジ時間 4,794 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.buffer.readline

def answer():
    A,B,K = map(int,input().split())
    
    def is_ok(x):
        
        tmp = (x//A) + (x//B) - (x//(A*B//math.gcd(A,B)))
        
        return x-tmp >= K
        
    y = (1<<70)
    x = 0
    while y-x>1:
        mid = (y+x)//2
        if is_ok(mid):
            y = mid
        else:
            x = mid
    print(y)
for _ in range(int(input())):
    answer()
0