結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 seekworserseekworser
提出日時 2023-11-04 00:47:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 621 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 81,708 KB
実行使用メモリ 76,068 KB
最終ジャッジ日時 2023-11-04 00:47:08
合計ジャッジ時間 7,204 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,784 KB
testcase_01 AC 54 ms
53,784 KB
testcase_02 AC 31 ms
53,784 KB
testcase_03 AC 590 ms
76,056 KB
testcase_04 AC 612 ms
76,064 KB
testcase_05 AC 574 ms
76,060 KB
testcase_06 AC 621 ms
76,068 KB
testcase_07 AC 574 ms
76,064 KB
testcase_08 AC 556 ms
76,064 KB
testcase_09 AC 506 ms
76,064 KB
testcase_10 AC 580 ms
76,056 KB
testcase_11 AC 516 ms
76,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
import math
for _ in range(T):
  a,b,k=map(int, input().split())
  c=a*b//math.gcd(a,b)
  ok,ng=0,6*10**18+1
  while (ng-ok)>1:
    mid=(ok+ng)//2
    d=mid-mid//a-mid//b+mid//c
    if d>=k:
      ng=mid 
    else:
      ok=mid 
  print(ng)
0