結果

問題 No.2526 Kth Not-divisible Number
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-08 04:38:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 77,336 KB
最終ジャッジ日時 2023-11-08 04:38:24
合計ジャッジ時間 11,086 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
55,732 KB
testcase_01 WA -
testcase_02 AC 45 ms
55,732 KB
testcase_03 AC 995 ms
76,812 KB
testcase_04 AC 998 ms
76,812 KB
testcase_05 AC 971 ms
76,812 KB
testcase_06 AC 1,002 ms
76,812 KB
testcase_07 AC 1,003 ms
76,968 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 582 ms
77,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.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<<60)
    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