AT_abc479_a.Odd Index Sum
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer sequence of length N: A=(A1,A2,…,AN).
Find the sum of the odd-indexed terms of A.
More formally, find the sum of Ai over all odd i satisfying 1≤i≤N.
给你一个长度为 N 的整数序列:A=(A1,A2,…,AN)。
求 A 中所有奇数下标项的和。
更准确地说,求满足 1≤i≤N 的所有奇数 i 对应的 Ai 之和。
输入格式
The input is given from Standard Input in the following format:
N
A1 A2 … AN
输入从标准输入中按以下格式给出:
N
A1 A2 … AN
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
5 3 1 4 1 5
输出#1
12
输入#2
6 2 7 1 8 2 8
输出#2
5
输入#3
9 100 40 30 50 20 90 100 80 60
输出#3
310
说明/提示
Sample 1 Explanation:
In this input, A=(3,1,4,1,5), and the terms to be summed are A1,A3,A5.
Output their sum, that is, 3+4+5=12.
Sample 2 Explanation:
In this input, A=(2,7,1,8,2,8), and the terms to be summed are A1,A3,A5.
Output their sum, that is, 2+1+2=5.
Constraints
- All input values are integers.
- 1≤N≤100
- 1≤Ai≤100
样例 1 解释:
本输入中,A=(3,1,4,1,5),需累加的项为 A1,A3,A5。
输出它们的和,即 3+4+5=12。
样例 2 解释:
本输入中,A=(2,7,1,8,2,8),需累加的项为 A1,A3,A5。
输出它们的和,即 2+1+2=5。
限制条件
- 所有输入值均为整数。
- 1≤N≤100
- 1≤Ai≤100
输入解题思路,AI测评打分。不知道怎么写?