CF305A.Strange Addition
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
不幸的是,瓦夏只能对满足如下条件的整数对 (a,b) 求和:对于任意十进制数位,至少有一个数在该数位上的数字为 0。例如,瓦夏可以对 505 和 50 求和,但他不能对 1 和 4 求和。
瓦夏有一个由 k 个互不相同的非负整数组成的集合 d1, d2, …, dk。
瓦夏希望从该集合中选出若干个整数,使得其中任意两个被选中的数均可相加(即满足上述条件)。他最多能选出多少个整数,以满足这一要求?
输入格式
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).
第一行输入包含一个整数 k(1≤k≤100)—— 表示整数的个数。
第二行包含 k 个互不相同的、以空格分隔的整数 d1, d2, …, dk(0≤di≤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.
第一行输出一个整数 n,表示所选整数的最大个数。
第二行输出 n 个互不相同的非负整数——即所要求的整数。
若存在多种解法,输出任意一种即可。这些数字可以以任意顺序输出。
输入输出样例
输入#1
4 100 10 1 0
输出#1
4 0 1 10 100
输入#2
3 2 70 3
输出#2
2 2 70
输入解题思路,AI测评打分。不知道怎么写?