codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

875A.md (1426B)


      1 Source: https://codeforces.com/problemset/problem/875/A
      2 
      3 A. Classroom Watch
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 512 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number *n*. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that *n* is the answer to the arithmetic task for first-graders. In the textbook, a certain positive integer *x* was given. The task was to add *x* to the sum of the digits of the number *x* written in decimal numeral system.
     22 
     23 Since the number *n* on the board was small, Vova quickly guessed which *x* could be in the textbook. Now he wants to get a program which will search for arbitrary values of the number *n* for all suitable values of *x* or determine that such *x* does not exist. Write such a program for Vova.
     24 
     25 Input
     26 
     27 The first line contains integer *n* (1 ≤ *n* ≤ 109).
     28 
     29 Output
     30 
     31 In the first line print one integer *k* — number of different values of *x* satisfying the condition.
     32 
     33 In next *k* lines print these values in ascending order.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 21
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 1  
     47 15
     48 ```
     49 
     50 Input
     51 
     52 ```
     53 20
     54 ```
     55 
     56 Output
     57 
     58 ```
     59 0
     60 ```
     61 
     62 Note
     63 
     64 In the first test case *x* = 15 there is only one variant: 15 + 1 + 5 = 21.
     65 
     66 In the second test case there are no such *x*.