Problem3084--C. 数字谜题

3084: C. 数字谜题

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

乐乐的《趣味数学》书上有这样一个数学谜题:

有 lns="http://www.w3.org/1998/Math/MathML">N 个整数,请按下列步骤寻找符合要求的数字:

  1. 将每个数的每一位拆出来后,统计出一共有多少位数字的值除以 lns="http://www.w3.org/1998/Math/MathML">3 的余数为 lns="http://www.w3.org/1998/Math/MathML">0
  2. 统计结束后,如果统计的结果是偶数,那么这个数就是符合要求的数字;

请将所有符合要求的数字按照从小到大的顺序排序后输出;

乐乐觉得一个一个找实在是太慢了,他决定请学过编程的你帮忙写一个程序,帮他快速的找出答案。

Input

第 lns="http://www.w3.org/1998/Math/MathML">1 行读入一个整数 lns="http://www.w3.org/1998/Math/MathML">N,代表要读入数字的数量;

第 lns="http://www.w3.org/1998/Math/MathML">2 行读入 lns="http://www.w3.org/1998/Math/MathML">N 个整数,用空格隔开;

Output

输出若干行,每行一个整数,按照从小到大的顺序,输出所有符合要求的数字。

Sample Input Copy

8
138 290 3589 230 62 882 981 12000

Sample Output Copy

230
290
882
3589

HINT

样例2输入:
10
16716 14533 2394 29326 26186 31867 10090 22792 31775 15732 



样例2输出:
2394
10090
14533
16716
26186
31867

样例 lns="http://www.w3.org/1998/Math/MathML">1 解释

读入的数据中,lns="http://www.w3.org/1998/Math/MathML">290lns="http://www.w3.org/1998/Math/MathML">3589lns="http://www.w3.org/1998/Math/MathML">230lns="http://www.w3.org/1998/Math/MathML">882,均是满足条件的整数,以 lns="http://www.w3.org/1998/Math/MathML">290 为例:数字 lns="http://www.w3.org/1998/Math/MathML">290 中,lns="http://www.w3.org/1998/Math/MathML">9 和 lns="http://www.w3.org/1998/Math/MathML">0 除以 lns="http://www.w3.org/1998/Math/MathML">3 的余数都为 lns="http://www.w3.org/1998/Math/MathML">0,因此 lns="http://www.w3.org/1998/Math/MathML">290 各个位中有 lns="http://www.w3.org/1998/Math/MathML">2 位数除以 lns="http://www.w3.org/1998/Math/MathML">3 的余数为 lns="http://www.w3.org/1998/Math/MathML">0,符合题目要求的统计结果为偶数的要求。

数据范围

对于 lns="http://www.w3.org/1998/Math/MathML">100\% 的数据 lns="http://www.w3.org/1998/Math/MathML">1 \le N \le 10000,第二行读入的每个数 lns="http://www.w3.org/1998/Math/MathML">A_i 所在的范围为 lns="http://www.w3.org/1998/Math/MathML">1 \le A_i \le 1000000

Source/Category