結果
| 問題 |
No.1176 少ない質問
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:16:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 1,000 ms |
| コード長 | 822 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 82,728 KB |
| 実行使用メモリ | 54,424 KB |
| 最終ジャッジ日時 | 2025-03-20 21:17:42 |
| 合計ジャッジ時間 | 1,776 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
A = int(input())
min_nm = float('inf')
# Consider M from 1 to 100 to cover larger values that might yield smaller products
for M in range(1, 101):
# Determine the minimum N such that N^M >= A using binary search
left, right = 1, 1
# Expand right until right^M >= A
while True:
current = pow(right, M)
if current < A:
left = right
right *= 2
else:
break
# Binary search between left and right to find the smallest N
low, high = left, right
answer = right
while low <= high:
mid = (low + high) // 2
val = pow(mid, M)
if val >= A:
answer = mid
high = mid - 1
else:
low = mid + 1
nm = answer * M
if nm < min_nm:
min_nm = nm
print(min_nm)
lam6er