A9029 | Strange Addition
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
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)$ .
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.
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted