L - MaratonIME doesn't like odd numbers( Gym - 101375L )

L - MaratonIME doesn't like odd numbers

 Gym - 101375L 

Problem Description

Statements

Estrela is known for defending tolerance time in delay tolerance. When he was attending to his MAC101 classes, there was a 15 minutes tolerance for delays and once he got 19 minutes late to the class. Estrela lost 7 points in his grade because of this even after he tried to explain how big the line for the Hot-Dog truck was. Later that day, he was talking about this situation during a training day for MaratonIME when Yan noticed a something odd: there was a 15 minutes delay tolerance, Estrela was 19 minutes late and lost 7 points. He said: "Estrela, can't you see? These are all odd numbers!".

The observation startled them and they realized that many of MaratonIME's catchphrases had a odd number of alphanumeric characters: "Oh, Fox!", "7", "Wubalubbadubdub", among others. That could not be a coincidence! They also realized that in their own names: Estrela and Yan.

Sena, whose name doesn't fit the observations, wants people to stop worrying about this kind of nonsense and focus on their training but he's busy trying to contain the great ruckus caused by the "7 Theory".

You agree with Sena and believe that if you create a super catchphrase with even length, people won't believe this crazy theory anymore. A super catchphrase is the concatenation of some (possibly none) catchphrases, as an example, "Da Matta is big." (12 alphanumeric characters) and "What a man!" (8 alphanumeric characters) can be used to make the super catchphrase "Da Matta is big. What a man!" (22 alphanumeric characters).

Since MaratonIME has a gigantic amount of catchphrases, you have to make a program that will determine the size of the greatest even length possible for a super catchphrase that is the concatenation of some (possibly none) of MaratonIME catchphrases. Note that if no super catchphrase with even length can be created the answer is 0.

Input

On the first line there will be an integer n, the amount of catchphrases and, on the second line, nintegers, the i-th integer, ai, is the amount of alphanumerics on the i-th catchphrase.

Limits

  • 1 ≤ n ≤ 105.
  • 1 ≤ ai ≤ 104.

Output

Print the largest even size of a super catchphrase.

Examples

Input

3
1 2 4

Output

6

 

Input

6
4 8 15 16 23 42

Output

108

代码如下:

Hint:本题题目比较长还是英文的,题目主要讲的是总长序列中序列个数和为偶数,如果是奇数只能减去最小的奇数序列。

代码比较简单,题目不好懂。。。。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i, n, sum = 0, a, min;
    scanf("%d", &n);
    min = 10000;  // 因为最大的数才为10000
    for(i = 0; i < n; i++)
    {
        scanf("%d", &a);
        if(a % 2 && min > a)  // 判断奇数,并把最小的奇数存下来
            min = a;
        sum += a;
    }
    if(sum % 2) sum -= min;
    printf("%d\n", sum); // 总和减去最小的奇数即为最长的偶数超级序列
    return 0;
}
// 题目中的0不需要特判,因为在0的情况只有一个奇数的时候,这个时候奇数被自身减去,进而变成了0

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WMYBlog

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值