問題一覧 > 通常問題

No.2479 Sum of Squares

レベル : / AI推定難易度 : 600 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 198
作問者 : takumaiq / テスター : ytqm3 keisuke6
お気に入りにしたユーザー ProblemId : 10135 / 自分の提出
問題文最終更新日: 2023-09-22 17:32:27
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 405 技術室奥プログラミングコンテスト#7 Day1 (順位表) の他の問題:

Problem Statement

Given a positive integer $S$, find one sequence $A$ of positive integers of length at most $15$ that satisfies the following conditions.

  • $A_i (1 \leq i \leq |A|)$ is a perfect square
  • $\displaystyle \sum_{i=1}^{|A|} A_i=S$

Input

$S$
  • $1 \leq S \leq 10^{18}$
  • All inputs are integers

Output

Print the length of the sequence on the first line, and print the elements of the sequence on the second line, separated by spaces.

Sample

Sample 1
Input
14
Output
3
1 4 9

$14=1+4+9$, and $1,4,9$ are all perfect squares.

Sample 2
Input
43
Output
3
25 9 9

It can also be written as $43=25+16+1+1$. There may be multiple solutions.

Sample 3
Input
34764
Output
10
8100 4 3721 784 100 1225 8649 7056 900 4225

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。