結果

問題 No.2526 Kth Not-divisible Number
ユーザー nikoro256nikoro256
提出日時 2023-11-03 21:52:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,034 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 76,292 KB
最終ジャッジ日時 2023-11-03 21:52:35
合計ジャッジ時間 9,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,840 KB
testcase_01 AC 38 ms
53,840 KB
testcase_02 AC 32 ms
53,840 KB
testcase_03 AC 965 ms
76,156 KB
testcase_04 AC 997 ms
76,156 KB
testcase_05 AC 1,011 ms
76,156 KB
testcase_06 AC 1,017 ms
76,156 KB
testcase_07 AC 1,034 ms
76,292 KB
testcase_08 AC 763 ms
76,156 KB
testcase_09 AC 669 ms
76,156 KB
testcase_10 AC 805 ms
76,156 KB
testcase_11 AC 702 ms
76,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def isok(n):
    ans=n-n//A-n//B+n//math.lcm(A,B)
    if ans<K:
        return True
    return False

T=int(input())
for _ in range(T):
    A,B,K=map(int,input().split())
    left,right=0,3*10**18+1
    while right-left>1:
        mid=(right+left)//2
        if isok(mid):
            left=mid
        else:
            right=mid
    print(right)
0