結果

問題 No.2526 Kth Not-divisible Number
ユーザー naesiranaesira
提出日時 2023-11-28 18:44:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 326 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 17,044 KB
最終ジャッジ日時 2023-11-28 18:44:47
合計ジャッジ時間 4,405 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
17,044 KB
testcase_01 AC 34 ms
10,112 KB
testcase_02 AC 30 ms
10,112 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import lcm

def is_ok(md):
  cnt = md - md//A - md//B + md//L
  return cnt >= K
def bis(ok, ng):
  while abs(ok - ng) > 1:
    md = (ng + ok) // 2
    if is_ok(md): ok = md
    else: ng = md
  return ok

for _ in range(T := int(input())):
  A, B, K = map(int, input().split())
  L = lcm(A, B)
  print(bis(10**19, 0))
0