結果

問題 No.2526 Kth Not-divisible Number
ユーザー ニックネームニックネーム
提出日時 2023-11-03 21:33:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 661 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 76,200 KB
最終ジャッジ日時 2023-11-03 21:33:58
合計ジャッジ時間 7,813 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,704 KB
testcase_01 AC 35 ms
53,704 KB
testcase_02 AC 35 ms
53,704 KB
testcase_03 AC 619 ms
76,064 KB
testcase_04 AC 661 ms
76,064 KB
testcase_05 AC 653 ms
76,068 KB
testcase_06 AC 637 ms
76,060 KB
testcase_07 AC 653 ms
76,200 KB
testcase_08 AC 621 ms
76,068 KB
testcase_09 AC 573 ms
76,060 KB
testcase_10 AC 626 ms
76,068 KB
testcase_11 AC 575 ms
76,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import lcm
for _ in range(int(input())):
    a,b,k = map(int,input().split())
    m = lcm(a,b); ng = 0; ok = 3*10**18
    while ok-ng>1:
        mid = (ng+ok)//2
        if mid-(mid//a+mid//b-mid//m)>=k: ok = mid
        else: ng = mid
    print(ok)
0