codeforces-scrape

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

305A.md (1282B)


      1 Source: https://codeforces.com/problemset/problem/305/A
      2 
      3 A. Strange Addition
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Unfortunately, Vasya can only sum pairs of integers (*a*, *b*), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.
     22 
     23 Vasya has a set of *k* distinct non-negative integers *d*1, *d*2, ..., *d**k*.
     24 
     25 Vasya wants to choose some integers from this set so that he could sum any two chosen numbers. What maximal number of integers can he choose in the required manner?
     26 
     27 Input
     28 
     29 The first input line contains integer *k* (1 ≤ *k* ≤ 100) — the number of integers.
     30 
     31 The second line contains *k* distinct space-separated integers *d*1, *d*2, ..., *d**k* (0 ≤ *d**i* ≤ 100).
     32 
     33 Output
     34 
     35 In the first line print a single integer *n* the maximum number of the chosen integers. In the second line print *n* distinct non-negative integers — the required integers.
     36 
     37 If there are multiple solutions, print any of them. You can print the numbers in any order.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 4  
     45 100 10 1 0
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 4  
     52 0 1 10 100
     53 ```
     54 
     55 Input
     56 
     57 ```
     58 3  
     59 2 70 3
     60 ```
     61 
     62 Output
     63 
     64 ```
     65 2  
     66 2 70
     67 ```