/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 100 点
問題文
長さ N の整数列 A=(A_1,A_2,\dots,A_N) が与えられます。
A の奇数番目の項の総和を求めてください。
より厳密には、 1 \le i \le N を満たす全ての奇数 i にわたる A_i の総和を求めてください。
制約
- 入力は全て整数
- 1 \le N \le 100
- 1 \le A_i \le 100
入力
入力は以下の形式で標準入力から与えられる。
N A_1 A_2 \dots A_N
出力
答えを出力せよ。
入力例 1
5 3 1 4 1 5
出力例 1
12
この入力では A=(3,1,4,1,5) であり、足し合わせるべきは A_1,A_3,A_5 です。
これらの和、つまり 3+4+5=12 を出力してください。
入力例 2
6 2 7 1 8 2 8
出力例 2
5
この入力では A=(2,7,1,8,2,8) であり、足し合わせるべきは A_1,A_3,A_5 です。
これらの和、つまり 2+1+2=5 を出力してください。
入力例 3
9 100 40 30 50 20 90 100 80 60
出力例 3
310
Score : 100 points
Problem Statement
You are given an integer sequence of length N: A=(A_1,A_2,\dots,A_N).
Find the sum of the odd-indexed terms of A.
More formally, find the sum of A_i over all odd i satisfying 1 \le i \le N.
Constraints
- All input values are integers.
- 1 \le N \le 100
- 1 \le A_i \le 100
Input
The input is given from Standard Input in the following format:
N A_1 A_2 \dots A_N
Output
Output the answer.
Sample Input 1
5 3 1 4 1 5
Sample Output 1
12
In this input, A=(3,1,4,1,5), and the terms to be summed are A_1,A_3,A_5.
Output their sum, that is, 3+4+5=12.
Sample Input 2
6 2 7 1 8 2 8
Sample Output 2
5
In this input, A=(2,7,1,8,2,8), and the terms to be summed are A_1,A_3,A_5.
Output their sum, that is, 2+1+2=5.
Sample Input 3
9 100 40 30 50 20 90 100 80 60
Sample Output 3
310