301610: CF305A. Strange Addition

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Strange Addition

题意翻译

不幸的是,Vasya一次只能将两个数相加,并且这两个数的每一个十进制位上至少有一个数为0。例如,Vasya能够将505和50相加,而不能将1和4相加。 现在Vasya有一个数组$d_1,d_2,...,d_k(1<=k<=100,0<=d_i<=100)$,而Vasya想要从这个数组中选出几个数,而且选出的数中每两个他都能相加。 求他最多可以选择多少个数并输出一个方案。如果有多组解,你可以以任意的顺序输出任意一组解。

题目描述

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 $ . Vasya has a set of $ k $ distinct non-negative integers $ d_{1},d_{2},...,d_{k} $ . 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?

输入输出格式

输入格式


The first input line contains integer $ k $ $ (1<=k<=100) $ — the number of integers. The second line contains $ k $ distinct space-separated integers $ d_{1},d_{2},...,d_{k} $ $ (0<=d_{i}<=100) $ .

输出格式


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. If there are multiple solutions, print any of them. You can print the numbers in any order.

输入输出样例

输入样例 #1

4
100 10 1 0

输出样例 #1

4
0 1 10 100 

输入样例 #2

3
2 70 3

输出样例 #2

2
2 70 

Input

题意翻译

不幸的是,Vasya一次只能将两个数相加,并且这两个数的每一个十进制位上至少有一个数为0。例如,Vasya能够将505和50相加,而不能将1和4相加。 现在Vasya有一个数组$d_1,d_2,...,d_k(1<=k<=100,0<=d_i<=100)$,而Vasya想要从这个数组中选出几个数,而且选出的数中每两个他都能相加。 求他最多可以选择多少个数并输出一个方案。如果有多组解,你可以以任意的顺序输出任意一组解。

加入题单

算法标签: