P24957 [AtCoder] [ARC034B] Equation
普及
题目描述

Problem Description

For a positive integer $ n $, let $ f(n) $ denote the sum of the digits in the decimal representation of $ n $. For example, $ f(123) = 1 + 2 + 3 = 6 $, and $ f(4) = 4 $.

Given a positive integer $ N $, find all positive integers $ x $ that satisfy the equation $ x + f(x) = N $.

Input Format

The input is given from the standard input in the following format:

$ N $

  • The first line contains one integer $ N $ ($1 \leq N \leq 10^{18}$).

Output Format

Let $ k $ be the number of positive integers $ x $ that satisfy the equation. Output $ k $ on the first line, followed by $ k $ lines each containing one positive integer $ x $ in ascending order that satisfies the equation.

Do not forget the newline at the end of the output.

Sample Input and Output

Sample Input #1

8

Sample Output #1

1
4

Sample Input #2

101

Sample Output #2

2
91
100

Sample Input #3

108

Sample Output #3

0

Notes/Hints

Partial Points

This problem has partial points.

  • $ 20 $ points are awarded for test cases where $1 \leq N \leq 1000$.

Sample Explanation 1

As stated in the problem, $ f(4) = 4 $, and no other positive integer satisfies the condition.

Sample Explanation 2

There can be multiple solutions.

Sample Explanation 3

There can also be no solutions.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
8
样例输出
1 4