結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
wgrape
|
| 提出日時 | 2023-12-13 09:46:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 489 bytes |
| コンパイル時間 | 751 ms |
| コンパイル使用メモリ | 82,072 KB |
| 実行使用メモリ | 78,344 KB |
| 最終ジャッジ日時 | 2024-09-27 05:16:18 |
| 合計ジャッジ時間 | 25,713 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 9 |
ソースコード
T = int(input())
import math
def is_ok(x,a,b,k): # xに対して、aでもbでも割り切れない数がk個以上存在すればTrue
g = math.gcd(a, b)
L = a // g * b
cnt = x - (x // a) - (x // b) + (x // L)
return cnt >= k
for _ in range(T):
A,B,K = map(int,input().split())
ok = 10 ** 20
ng = 0
while abs(ok - ng) > 1:
mid = abs(ok + ng) // 2
if is_ok(mid, A, B, K):
ok = mid
else:
ng = mid
print(ok)
wgrape