A12460 | Parity
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You are given an integer $n$ ( $n \ge 0$ ) represented with $k$ digits in base (radix) $b$ . So,
$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$
For example, if $b=17, k=3$ and $a=\[11, 15, 7\]$ then $n=11\\cdot17^2+15\\cdot17+7=3179+255+7=3441$
Determine whether $n$ is even or odd.
$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$
For example, if $b=17, k=3$ and $a=\[11, 15, 7\]$ then $n=11\\cdot17^2+15\\cdot17+7=3179+255+7=3441$
Determine whether $n$ is even or odd.
输入格式
The first line contains two integers $b$ and $k$ ( $2\le b\le 100$ , $1\le k\le 10^5$ ) — the base of the number and the number of digits.
The second line contains $k$ integers $a_1, a_2, \ldots, a_k$ ( $0\le a_i < b$ ) — the digits of $n$ .
The representation of $n$ contains no unnecessary leading zero. That is, $a_1$ can be equal to $0$ only if $k = 1$ .
The second line contains $k$ integers $a_1, a_2, \ldots, a_k$ ( $0\le a_i < b$ ) — the digits of $n$ .
The representation of $n$ contains no unnecessary leading zero. That is, $a_1$ can be equal to $0$ only if $k = 1$ .
输出格式
Print "even" if $n$ is even, otherwise print "odd".
You can print each letter in any case (upper or lower).
You can print each letter in any case (upper or lower).
输入输出样例
输入 #1
13 3 3 2 7
输出 #1
even
输入 #2
10 9 1 2 3 4 5 6 7 8 9
输出 #2
odd
输入 #3
99 5 32 92 85 74 4
输出 #3
odd
输入 #4
2 2 1 0
输出 #4
even
In the first example, $n = 3 \cdot 13^2 + 2 \cdot 13 + 7 = 540$ , which is even.
In the second example, $n = 123456789$ is odd.
In the third example, $n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$ is odd.
In the fourth example $n = 2$ .
In the second example, $n = 123456789$ is odd.
In the third example, $n = 32 \cdot 99^4 + 92 \cdot 99^3 + 85 \cdot 99^2 + 74 \cdot 99 + 4 = 3164015155$ is odd.
In the fourth example $n = 2$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted