結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,796 KB
testcase_01 AC 35 ms
53,796 KB
testcase_02 AC 35 ms
53,796 KB
testcase_03 AC 658 ms
76,072 KB
testcase_04 AC 657 ms
76,072 KB
testcase_05 AC 661 ms
76,072 KB
testcase_06 AC 654 ms
76,068 KB
testcase_07 AC 665 ms
76,072 KB
testcase_08 AC 629 ms
76,072 KB
testcase_09 AC 631 ms
76,064 KB
testcase_10 AC 673 ms
76,076 KB
testcase_11 AC 567 ms
76,072 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,2**62
  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