PivotOJ

Jacobi Numbers

시간 제한: 1000ms메모리 제한: 2048MB출처: BAPC 2025BOJ 35213

문제

Today, a new paper has been published in the Bulletin of Apocryphal Pioneers in Computation. According to this paper, the forgotten German number theorist Wahnfried Imaginus Jacobi (1806--1853), while still a secondary student in Potsdam, investigated the decomposition of integers into sums of cubes. Among the examples noted in the surviving fragments of his notebooks are \[ 2025 = 1^3 + 2^3 + 3^3 + 4^3 + 5^3 + 6^3 + 7^3 + 8^3 + 9^3 \] and the more curious expression \[ 3 = 1^3 + 1^3 + 1^3 = 4^3 + 4^3 + (-5)^3\,,\] which shows that a solution need not be unique. Jacobi restricted his attention to small integers and probably did not know the decomposition \[ 3 = 569\,936\,821\,221\,962\,380\,720^3 + (-569\,936\,821\,113\,563\,493\,509)^3 + (-472\,715\,493\,453\,327\,032)^3 \,,\] which was discovered only recently.1 However, Jacobi did manage to prove that a decomposition into cubes always exists for all positive integers up to 92419241, the 2828th cuban prime of the first kind. Although his work was never published, references to the method appear in a marginal annotation in an 1823 letter to his famous brother Carl Gustav Jacob.

Given a positive integer nn, output a list of at most 1000010\,000 integers between 10000-10\,000 and 1000010\,000 such that the sum of their cubes equals nn.


1Booker, Andrew R.; Sutherland, Andrew V. (2021), "On a question of Mordell", Proceedings of the National Academy of Sciences, 118 (11)

입력

The input consists of:

  • One line with an integer nn (1n92411\leq n\leq 9241), the number to decompose into cubes.

출력

Output an integer kk (1k100001 \leq k \leq 10\,000), the number of terms in your solution, followed by kk integers a1,,aka_1,\ldots, a_k (10000ai10000-10\,000\leq a_i\leq10\,000 for each ii), such that a13++ak3=na_1^3 + \dots + a_k^3 = n.

If there are multiple valid solutions, you may output any one of them.

예제

예제 1

입력
2025
출력
9
1 2 3 4 5 6 7 8 9

예제 2

입력
45
출력
3
2025 -2369 1709

예제 3

입력
15
출력
3
-1 2 2

예제 4

입력
9241
출력
2
-55 56
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.