AT_abc473_a.Second Half Sum

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer sequence of length NN: A=(A1,A2,…,AN)A=(A_1,A_2,\dots,A_N). Here, NN is even.
Find the sum of the latter half of AA, that is, the sum of A(N/2)+1,A(N/2)+2,…,ANA_{(N/2)+1},A_{(N/2)+2},\dots,A_{N}.

给你一个长度为 NN 的整数序列:A=(A1,A2,…,AN)A=(A_1,A_2,\dots,A_N)。其中,NN 为偶数。
求 AA 的后半部分的元素之和,即 A(N/2)+1,A(N/2)+2,…,ANA_{(N/2)+1},A_{(N/2)+2},\dots,A_{N} 的和。

输入格式

The input is given from Standard Input in the following format:

NN
A1A_1 A2A_2 …\dots ANA_N

输入从标准输入中按以下格式给出:

NN
A1A_1 A2A_2 …\dots ANA_N

输出格式

Output the answer.

输出答案。

输入输出样例

  • 输入#1

    8
    1 3 7 8 4 2 5 6

    输出#1

    17
  • 输入#2

    2
    1 100

    输出#2

    100
  • 输入#3

    10
    31 41 59 26 53 58 97 93 23 84

    输出#3

    355

说明/提示

Sample 1 Explanation:
The length of the sequence AA is N=8N=8, and you should find the sum of A5,A6,A7,A8A_5,A_6,A_7,A_8.
Since A5+A6+A7+A8=4+2+5+6=17A_5+A_6+A_7+A_8 = 4+2+5+6=17, output 1717.

Constraints

  • All input values are integers.
  • NN is an even number satisfying 2≤N≤1002 \le N \le 100.
  • 1≤Ai≤1001 \le A_i \le 100

样例 1 解释:
序列 AA 的长度为 N=8N=8,你需要计算 A5,A6,A7,A8A_5,A_6,A_7,A_8 的和。
由于 A5+A6+A7+A8=4+2+5+6=17A_5+A_6+A_7+A_8 = 4+2+5+6=17,因此输出 1717。

约束条件

  • 所有输入值均为整数。
  • NN 是满足 2≤N≤1002 \le N \le 100 的偶数。
  • 1≤Ai≤1001 \le A_i \le 100

输入解题思路,AI测评打分。不知道怎么写?

首页