結果

問題 No.2526 Kth Not-divisible Number
ユーザー ntudantuda
提出日時 2023-11-04 11:50:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 81,888 KB
実行使用メモリ 76,192 KB
最終ジャッジ日時 2023-11-04 11:50:16
合計ジャッジ時間 7,567 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,664 KB
testcase_01 WA -
testcase_02 AC 35 ms
53,664 KB
testcase_03 AC 642 ms
76,144 KB
testcase_04 AC 646 ms
76,172 KB
testcase_05 AC 666 ms
76,148 KB
testcase_06 AC 684 ms
76,180 KB
testcase_07 AC 640 ms
76,144 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import lcm
for _ in range(int(input())):
    A,B,K = map(int,input().split())
    C = lcm(A,B)

    lb = K
    ub = K * 10

    while ub - lb > 1:
        mid = (ub + lb) // 2
        if mid - mid//A - mid//B + mid//C <= K:
            lb = mid
        else:
            ub = mid
    print(lb)
0