結果

問題 No.2526 Kth Not-divisible Number
ユーザー moon17moon17
提出日時 2023-11-03 23:56:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 704 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 3,965 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 76,076 KB
最終ジャッジ日時 2023-11-03 23:56:35
合計ジャッジ時間 8,780 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,712 KB
testcase_01 AC 36 ms
53,712 KB
testcase_02 AC 34 ms
53,712 KB
testcase_03 AC 681 ms
76,076 KB
testcase_04 AC 699 ms
76,068 KB
testcase_05 AC 667 ms
76,076 KB
testcase_06 AC 704 ms
76,072 KB
testcase_07 AC 671 ms
76,068 KB
testcase_08 AC 656 ms
76,076 KB
testcase_09 AC 608 ms
76,072 KB
testcase_10 AC 679 ms
76,072 KB
testcase_11 AC 600 ms
76,072 KB
権限があれば一括ダウンロードができます

ソースコード

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**19,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