codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

59B.md (1534B)


      1 Source: https://codeforces.com/problemset/problem/59/B
      2 
      3 B. Fortune Telling
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several camomiles and tears off the petals one by one. After each petal she pronounces alternatively "Loves" and "Doesn't love", at that Marina always starts with "Loves". There are *n* camomiles growing in the field, possessing the numbers of petals equal to *a*1, *a*2, ... *a**n*. Marina wants to pick a bouquet with the maximal possible total number of petals so that the result would still be "Loves". Help her do that; find the maximal number of petals possible in the bouquet.
     22 
     23 Input
     24 
     25 The first line contains an integer *n* (1 ≤ *n* ≤ 100), which is the number of flowers growing in the field. The second line contains *n* integers *a**i* (1 ≤ *a**i* ≤ 100) which represent the number of petals on a given *i*-th camomile.
     26 
     27 Output
     28 
     29 Print a single number which is the maximal number of petals in the bouquet, the fortune telling on which would result in "Loves". If there are no such bouquet, print 0 instead. The bouquet may consist of a single flower.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 1  
     37 1
     38 ```
     39 
     40 Output
     41 
     42 ```
     43 1
     44 ```
     45 
     46 Input
     47 
     48 ```
     49 1  
     50 2
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 0
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 3  
     63 5 6 7
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 13
     70 ```