CF129A.Cookies
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there are many cookies, Olga decided that it's no big deal if she steals a bag. However, she doesn't want the sisters to quarrel because of nothing when they divide the cookies. That's why Olga wants to steal a bag with cookies so that the number of cookies in the remaining bags was even, that is, so that Anna and Maria could evenly divide it into two (even 0 remaining cookies will do, just as any other even number). How many ways there are to steal exactly one cookie bag so that the total number of cookies in the remaining bags was even?
奥尔加来拜访双胞胎安娜和玛丽亚,发现她们有很多饼干。这些饼干被分装在若干袋子中。由于饼干数量很多,奥尔加觉得偷走其中一袋也无伤大雅。然而,她不希望姐妹俩在分配剩余饼干时因数量问题而发生争执。因此,奥尔加想偷走恰好一袋饼干,使得剩余各袋中饼干总数为偶数——即安娜和玛丽亚可以将这些饼干平均分成两份(剩余 0 块饼干也是可以接受的,因为 0 也是偶数)。问:有多少种方式可以恰好偷走一袋饼干,使得剩余饼干总数为偶数?
输入格式
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of cookie bags Anna and Maria have. The second line contains n integers a__i (1 ≤ a__i ≤ 100) — the number of cookies in the i-th bag.
第一行包含唯一一个整数 n(1≤n≤100)—— 表示安娜和玛丽亚所拥有的饼干袋数量。
第二行包含 n 个整数 ai(1≤ai≤100)—— 表示第 i 个袋子中的饼干数量。
输出格式
Print in the only line the only number — the sought number of ways. If there are no such ways print 0.
在唯一的一行中输出唯一的数字——所求的方案数。如果没有这样的方案,则输出 0。
输入输出样例
输入#1
1 1
输出#1
1
输入#2
10 1 2 2 3 4 4 4 2 2 2
输出#2
8
输入#3
11 2 2 2 2 2 2 2 2 2 2 99
输出#3
1
说明/提示
In the first sample Olga should take the only bag so that the twins ended up with the even number of cookies.
In the second sample Olga can take any of five bags with two cookies or any of three bags with four cookies — 5 + 3 = 8 ways in total.
In the third sample, no matter which bag with two cookies Olga chooses, the twins are left with 2 * 9 + 99 = 117 cookies. Thus, Olga has only one option: to take the bag with 99 cookies.
在第一个样例中,奥尔加应取走唯一的一个袋子,使得双胞胎最终分得偶数块饼干。
在第二个样例中,奥尔加可以任选五个装有两块饼干的袋子之一,或任选三个装有四块饼干的袋子之一——总共 5+3=8 种方式。
在第三个样例中,无论奥尔加选择哪一个装有两块饼干的袋子,双胞胎最终都剩下 2×9+99=117 块饼干。因此,奥尔加只有一种选择:取走装有 99 块饼干的那个袋子。
输入解题思路,AI测评打分。不知道怎么写?