codeforces-scrape

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

489C.md (1034B)


      1 Source: https://codeforces.com/problemset/problem/489/C
      2 
      3 C. Given Length and Sum of Digits...
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 You have a positive integer *m* and a non-negative integer *s*. Your task is to find the smallest and the largest of the numbers that have length *m* and sum of digits *s*. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
     22 
     23 Input
     24 
     25 The single line of the input contains a pair of integers *m*, *s* (1 ≤ *m* ≤ 100, 0 ≤ *s* ≤ 900) — the length and the sum of the digits of the required numbers.
     26 
     27 Output
     28 
     29 In the output print the pair of the required non-negative integer numbers — first the minimum possible number, then — the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes).
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 2 15
     37 ```
     38 
     39 Output
     40 
     41 ```
     42 69 96
     43 ```
     44 
     45 Input
     46 
     47 ```
     48 3 0
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 -1 -1
     55 ```