

Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
長さ N の正整数列 A=(A_1,A_2,\dots,A_N) が与えられます。
A の奇数番目の要素の総和を求めてください。すなわち、N 以下の最大の奇数を m としたとき A_1+A_3+A_5+\ldots+A_m を求めてください。
制約
- 1\leq N\leq 100
- 1\leq A_i\leq 100
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \ldots A_N
出力
答えを出力せよ。
入力例 1
7 3 1 4 1 5 9 2
出力例 1
14
A の奇数番目の要素の総和は A_1+A_3+A_5+A_7=3+4+5+2=14 です。
入力例 2
1 100
出力例 2
100
入力例 3
14 100 10 1 10 100 10 1 10 100 10 1 10 100 10
出力例 3
403
Score : 100 points
Problem Statement
You are given a sequence of positive integers of length N: A=(A_1,A_2,\dots,A_N).
Find the sum of the odd-indexed elements of A. That is, find A_1 + A_3 + A_5 + \dots + A_m, where m is the largest odd number not exceeding N.
Constraints
- 1 \le N \le 100
- 1 \le A_i \le 100
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N A_1 A_2 \dots A_N
Output
Print the answer.
Sample Input 1
7 3 1 4 1 5 9 2
Sample Output 1
14
The sum of the odd-indexed elements of A is A_1+A_3+A_5+A_7=3+4+5+2=14.
Sample Input 2
1 100
Sample Output 2
100
Sample Input 3
14 100 10 1 10 100 10 1 10 100 10 1 10 100 10
Sample Output 3
403