CF621A.Wet Shark and Odd and Even

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark.

Note, that if Wet Shark uses no integers from the n integers, the sum is an even integer 0.

今天,Wet Shark 得到了 nn 个整数。Wet Shark 希望从中选取若干个数(每个数至多使用一次),使得它们的和尽可能大,且该和为偶数(即能被 22 整除)。请为 Wet Shark 计算这个最大可能的偶数和。

注意:如果 Wet Shark 不从这 nn 个整数中选取任何数,则和为偶数 00。

输入格式

The first line of the input contains one integer, n (1 ≤ n ≤ 100 000). The next line contains n space separated integers given to Wet Shark. Each of these integers is in range from 1 to 109, inclusive.

输入的第一行包含一个整数 nn(1≤n≤100 0001 \leq n \leq 100\,000)。下一行包含 nn 个用空格分隔的整数,这些整数即为 Wet Shark 所获得的数字。每个整数均在 11 到 10910^9 的范围内(含端点)。

输出格式

Print the maximum possible even sum that can be obtained if we use some of the given integers.

输出使用给定整数中的某些整数所能得到的最大可能的偶数和。

输入输出样例

  • 输入#1

    3
    1 2 3

    输出#1

    6
  • 输入#2

    5
    999999999 999999999 999999999 999999999 999999999

    输出#2

    3999999996

说明/提示

In the first sample, we can simply take all three integers for a total sum of 6.

In the second sample Wet Shark should take any four out of five integers 999 999 999.

在第一个样例中,我们可以直接取全部三个整数,总和为 66。

在第二个样例中,Wet Shark 应从五个整数 999 999 999999\,999\,999 中任取四个。

输入解题思路,AI测评打分。不知道怎么写?

首页