欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1110A.Parity
Parity
You are given an integer () represented with digits in base (radix) . So,
$$n = a_1 \cdot b^{k-1} + a_2 \cdot b^{k-2} + \ldots a_{k-1} \cdot b + a_k.$$</p><p>For example, if$b=17, k=3$and$a=[11, 15, 7]$then$n=11\cdot17^2+15\cdot17+7=3179+255+7=3441$.</p><p>Determine whether$n$ is even or odd. ## Input 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 \lt 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$. ## Output Print "`even`" if $n$ is even, otherwise print "`odd`". You can print each letter in any case (upper or lower). ## Note 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$. ## Samples ```input1 13 3 3 2 7 ``` ```output1 even ``` ```input2 10 9 1 2 3 4 5 6 7 8 9 ``` ```output2 odd ``` ```input3 99 5 32 92 85 74 4 ``` ```output3 odd ``` ```input4 2 2 1 0 ``` ```output4 even ```$$在线编程 IDE
建议全屏模式获得最佳体验
键盘快捷键
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |
第 1 行,第 1 列
0 字符
-
最近自测结果
暂未运行
最近递交结果
暂无递交记录