結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 timitimi
提出日時 2023-11-03 22:27:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 346 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 83,576 KB
最終ジャッジ日時 2023-11-03 22:27:46
合計ジャッジ時間 19,440 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,712 KB
testcase_01 AC 31 ms
53,712 KB
testcase_02 AC 34 ms
53,712 KB
testcase_03 AC 1,988 ms
82,256 KB
testcase_04 AC 1,972 ms
82,260 KB
testcase_05 AC 1,949 ms
82,256 KB
testcase_06 AC 1,985 ms
82,252 KB
testcase_07 AC 1,996 ms
82,260 KB
testcase_08 TLE -
testcase_09 AC 1,956 ms
82,052 KB
testcase_10 TLE -
testcase_11 AC 1,725 ms
83,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
from sys import stdin, setrecursionlimit
input = stdin.readline
readline = stdin.readline
import math
for _ in range(T):
  a,b,k=map(int, input().split())
  c=a*b//math.gcd(a,b)
  ok,ng=0,10**20+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