結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 timitimi
提出日時 2023-11-04 01:47:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 716 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 76,168 KB
最終ジャッジ日時 2023-11-04 01:47:38
合計ジャッジ時間 8,429 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,800 KB
testcase_01 AC 36 ms
53,800 KB
testcase_02 AC 36 ms
53,800 KB
testcase_03 AC 700 ms
76,164 KB
testcase_04 AC 673 ms
76,168 KB
testcase_05 AC 716 ms
76,168 KB
testcase_06 AC 714 ms
76,164 KB
testcase_07 AC 693 ms
76,168 KB
testcase_08 AC 677 ms
76,164 KB
testcase_09 AC 658 ms
76,168 KB
testcase_10 AC 710 ms
76,168 KB
testcase_11 AC 593 ms
76,164 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,11000000002000000005
  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