結果

問題 No.2526 Kth Not-divisible Number
ユーザー flygonflygon
提出日時 2023-11-03 21:28:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 81,876 KB
実行使用メモリ 78,504 KB
最終ジャッジ日時 2023-11-03 21:28:57
合計ジャッジ時間 3,329 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,792 KB
testcase_01 WA -
testcase_02 AC 40 ms
55,792 KB
testcase_03 AC 513 ms
76,964 KB
testcase_04 AC 522 ms
76,968 KB
testcase_05 AC 536 ms
77,036 KB
testcase_06 AC 526 ms
76,968 KB
testcase_07 AC 544 ms
76,976 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

def sol():
    a,b,k = map(int,input().split())
    ab = a*b//gcd(a,b)
    l = 0
    r = 2*10**18
    for i in range(70):
        m = (l+r)//2
        cnt = m-m//a-m//b+m//ab
        if cnt <= k:
            l = m
        else:
            r = m
    print(*[l])
    return 


T = int(input())
for i in range(T):
    sol()
0