#abc272c. C - Max Even
C - Max Even
Score : points
问题描述
给定一个包含非负整数的长度为 的序列 。
确定是否存在一个可以用 中两个不同元素之和表示的偶数。如果存在,找出这样的最大数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length consisting of non-negative integers.
Determine if there is an even number represented as the sum of two different elements of . If it exists, find the maximum such number.
Constraints
- The elements of are distinct.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print -1
if there is no even number represented as the sum of two different elements of .
If such an even number exists, print the maximum such number.
Sample Input 1
3
2 3 4
Sample Output 1
6
The values represented as the sum of two distinct elements of are , , and . We have an even number here, and the maximum is .
Sample Input 2
2
1 0
Sample Output 2
-1
The value represented as the sum of two distinct elements of is . We have no even number here, so -1
should be printed.
update @ 2024/3/10 11:27:35