結果

問題 No.2526 Kth Not-divisible Number
ユーザー sasa8uyauyasasa8uyauya
提出日時 2023-11-03 21:57:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,414 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 76,188 KB
最終ジャッジ日時 2023-11-03 21:57:57
合計ジャッジ時間 13,809 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,732 KB
testcase_01 AC 34 ms
53,732 KB
testcase_02 AC 34 ms
53,732 KB
testcase_03 AC 1,403 ms
76,160 KB
testcase_04 AC 1,414 ms
76,132 KB
testcase_05 AC 1,363 ms
76,132 KB
testcase_06 AC 1,382 ms
76,136 KB
testcase_07 AC 1,357 ms
76,132 KB
testcase_08 AC 1,322 ms
76,148 KB
testcase_09 AC 1,284 ms
76,140 KB
testcase_10 AC 1,315 ms
76,140 KB
testcase_11 AC 1,199 ms
76,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
import math
for _ in range(t):
  a,b,k=map(int,input().split())
  g=math.gcd(a,b)
  c=(a*b)//g
  l=200
  m=int(k*a*b*c/(a*b*c-a*c-b*c+a*b))
  for i in range(max(1,m-l),m+l):
    if i-(i//a+i//b-i//((a*b)//g))==k:
      print(i)
      break
0