結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | rlangevin |
提出日時 | 2023-11-03 21:25:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 81,832 KB |
実行使用メモリ | 83,612 KB |
最終ジャッジ日時 | 2023-11-03 21:26:01 |
合計ジャッジ時間 | 24,212 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,788 KB |
testcase_01 | AC | 38 ms
53,788 KB |
testcase_02 | AC | 35 ms
53,788 KB |
testcase_03 | TLE | - |
testcase_04 | TLE | - |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
ソースコード
import sys input = sys.stdin.readline from math import gcd def check(m, a, b): val = m val -= m // a + m // b lcm = a * b // gcd(a, b) return val + m // lcm T = int(input()) for _ in range(T): A, B, K = map(int, input().split()) yes = 10 ** 20 no = 0 while yes - no != 1: mid = (yes + no)//2 if check(mid, A, B) >= K: yes = mid else: no = mid print(yes)