eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Die Young

Die Young

Young diagram is a well known way to describe a partition of a positive integer number. A partition of a number \textbf{n}is a representation as a sum of one or several integer numbers \textbf{n = m_1 + m_2 + ... + m_k} where \textbf{m_1} ≥ \textbf{m_2} ≥ ... ≥ \textbf{m_k}. A diagram consists of \textbf{n} boxes arranged in \textbf{k} rows, where \textbf{k} is the number of terms in the partition. A row representing the number \textbf{m_i} contains mi boxes. All rows are left-aligned, and sorted from longest to shortest. The diagram on the picture below corresponds to the partition \textbf{10 = 5 + 3 + 2}. \includegraphics{https://static.e-olymp.com/content/7e/7ea3ba166549749842eee0ba412cbc8b11290908.jpg} Sometimes it is possible to inscribe one Young diagram into the other. Diagram \textbf{X} can be inscribed into the diagram \textbf{Y} if it is possible to delete some boxes from diagram \textbf{Y} so that it turns to diagram \textbf{X}. Note that it is only allowed to remove some boxes, it is not allowed to rotate or flip the diagram. For example, the picture below shows that the diagram for \textbf{5 = 3 + 2} can be inscribed into the diagram for \textbf{10 = 5 + 3 + 2}. \includegraphics{https://static.e-olymp.com/content/4f/4fbf6cceec3d1323591d47ad60ae99a0d3a1e968.jpg} On the other hand, for example, it is impossible to inscribe the diagram for \textbf{8 = 4+4} into the diagram for \textbf{10 = 5 + 3 + 2}. Given \textbf{n}, your task to find such partition of \textbf{n} that the corresponding Young diagram has the greatest possible number of diagrams that can be inscribed into it. For example, there are \textbf{36} Young diagrams that can be inscribed into the diagram for \textbf{10 = 5 + 3 + 2}. However, it is not the maximal possible value. The diagram for \textbf{10 = 4 + 2 + 2 + 1 + 1} has the better value, there are \textbf{41} diagrams that can be inscribed into it. \InputFile Input file contains \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{100}). \OutputFile At the first line of the output file print the maximal number of Young diagrams that can be inscibed into some Young diagram for the partition of \textbf{n}. At the second line print one or more integer numbers --- the number of boxes in each row of the optimal diagram.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
10
Выходные данные #1
41
4 2 2 1 1