結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 seekworserseekworser
提出日時 2023-11-04 00:47:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 632 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,192 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-09-25 21:44:01
合計ジャッジ時間 7,048 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,352 KB
testcase_01 AC 42 ms
52,352 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 621 ms
76,416 KB
testcase_04 AC 619 ms
76,544 KB
testcase_05 AC 629 ms
76,544 KB
testcase_06 AC 624 ms
76,032 KB
testcase_07 AC 632 ms
76,160 KB
testcase_08 AC 603 ms
76,160 KB
testcase_09 AC 571 ms
76,544 KB
testcase_10 AC 628 ms
76,672 KB
testcase_11 AC 528 ms
76,160 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