codeforces-scrape

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

919B.md (689B)


      1 Source: https://codeforces.com/problemset/problem/919/B
      2 
      3 B. Perfect Number
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 We consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given a positive integer $k$, your task is to find the $k$-th smallest perfect positive integer.
     22 
     23 Input
     24 
     25 A single line with a positive integer $k$ ($1 \leq k \leq 10\,000$).
     26 
     27 Output
     28 
     29 A single number, denoting the $k$-th smallest perfect integer.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 1
     37 ```
     38 
     39 Output
     40 
     41 ```
     42 19
     43 ```
     44 
     45 Input
     46 
     47 ```
     48 2
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 28
     55 ```
     56 
     57 Note
     58 
     59 The first perfect integer is $19$ and the second one is $28$.