結果

問題 No.2526 Kth Not-divisible Number
ユーザー moon17moon17
提出日時 2023-11-03 22:39:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 242 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 11,724 KB
実行使用メモリ 14,524 KB
最終ジャッジ日時 2023-11-03 22:39:57
合計ジャッジ時間 4,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from math import*
t=int(input())
for _ in range(t):
  a,b,k=map(int,input().split())
  l=a*b//gcd(a,b)
  ok,ng=10**20,0
  while abs(ok-ng)>1:
    mid=ok+ng>>1
    if k<=mid+mid//l-mid//a-mid//b:
      ok=mid
    else:
      ng=mid
  print(ok)
0