102940: [Atcoder]ABC294 A - Filter

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

Description

Score : $100$ points

Problem Statement

You are given a sequence of $N$ integers: $A=(A _ 1,A _ 2,\ldots,A _ N)$.

Print all even numbers in $A$ without changing the order.

Constraints

  • $1\leq N\leq 100$
  • $1\leq A _ i\leq 100\ (1\leq i\leq N)$
  • $A$ contains at least one even number.
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

$N$
$A _ 1$ $A _ 2$ $\ldots$ $A _ N$

Output

Print a line containing the sequence of all even numbers in $A$, with spaces in between.


Sample Input 1

5
1 2 3 5 6

Sample Output 1

2 6

We have $A=(1,2,3,5,6)$. Among them are two even numbers, $A _ 2=2$ and $A _ 5=6$, so print $2$ and $6$ in this order, with a space in between.


Sample Input 2

5
2 2 2 3 3

Sample Output 2

2 2 2

$A$ may contain equal elements.


Sample Input 3

10
22 3 17 8 30 15 12 14 11 17

Sample Output 3

22 8 30 12 14

Input

题意翻译

给定一个长度为 $n$ 的数列 $A$,按输入的顺序输出 $A$ 中的所有偶数,用空格分隔。

Output

得分:100分

问题描述

给你一个长度为$N$的整数序列$A=(A _ 1,A _ 2,\ldots,A _ N)$。

不改变顺序地打印出$A$中的所有偶数。

限制条件

  • $1\leq N\leq 100$
  • $1\leq A _ i\leq 100\ (1\leq i\leq N)$
  • $A$中至少包含一个偶数。
  • 输入中的所有值都是整数。

输入

输入从标准输入按照以下格式给出:

$N$
$A _ 1$ $A _ 2$ $\ldots$ $A _ N$

输出

打印一行,包含$A$中的所有偶数,用空格隔开。


样例输入1

5
1 2 3 5 6

样例输出1

2 6

我们有$A=(1,2,3,5,6)$。 其中有两个偶数,$A _ 2=2$和$A _ 5=6$,因此按照顺序打印出2和6,中间用空格隔开。


样例输入2

5
2 2 2 3 3

样例输出2

2 2 2

$A$可能包含相等的元素。


样例输入3

10
22 3 17 8 30 15 12 14 11 17

样例输出3

22 8 30 12 14

HINT

n个数,按顺序输出其中的偶数?

加入题单

算法标签: