P1249 Maximum Product
Description
A positive integer can generally be written as a sum of several pairwise distinct positive integers, such as $3=1+2$, $4=1+3$, $5=1+4=2+3$, $6=1+5=2+4$.
Your task is to decompose the given positive integer $n$ into a sum of several pairwise distinct positive integers (you may also choose not to decompose it and use the number itself), such that the product of these integers is maximized.
Input Format
A single positive integer $n$ ($3 \leq n \leq 10000$).
Output Format
The first line contains the decomposition, with adjacent numbers separated by a single space, in nondecreasing order.
The second line contains the maximum product.
Explanation/Hint
Translated by ChatGPT 5