CF962A.Equator

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Polycarp has created his own training plan to prepare for the programming contests. He will train for nn days, all days are numbered from 11 to nn, beginning from the first.

On the ii-th day Polycarp will necessarily solve aia_i problems. One evening Polycarp plans to celebrate the equator. He will celebrate it on the first evening of such a day that from the beginning of the training and to this day inclusive he will solve half or more of all the problems.

Determine the index of day when Polycarp will celebrate the equator.

Polycarp 为自己制定了编程竞赛训练计划。他将进行 nn 天的训练,所有天数从 11 到 nn 编号,从第一天开始。

在第 ii 天,Polycarp 必定会解决 aia_i 道题目。某天晚上,Polycarp 计划庆祝“赤道日”(equator)。他将在满足如下条件的最早一天的晚上庆祝:从训练开始到该天(含)为止,他所解决的题目总数达到全部题目总数的一半或更多。

请确定 Polycarp 庆祝赤道日的那天的编号(即天数索引)。

输入格式

The first line contains a single integer nn (1≤n≤200 0001 \le n \le 200\,000) — the number of days to prepare for the programming contests.

The second line contains a sequence a1,a2,…,ana_1, a_2, \dots, a_n (1≤ai≤10 0001 \le a_i \le 10\,000), where aia_i equals to the number of problems, which Polycarp will solve on the ii-th day.

第一行包含一个整数 nn(1≤n≤200 0001 \le n \le 200\,000)—— 表示为编程竞赛做准备的天数。

第二行包含一个序列 a1,a2,…,ana_1, a_2, \dots, a_n(1≤ai≤10 0001 \le a_i \le 10\,000),其中 aia_i 表示 Polycarp 在第 ii 天将要解决的问题数量。

输出格式

Print the index of the day when Polycarp will celebrate the equator.

输出 Polycarp 庆祝“赤道日”的那一天的索引。

输入输出样例

  • 输入#1

    4
    1 3 2 1

    输出#1

    2
  • 输入#2

    6
    2 2 2 2 2 2

    输出#2

    3

说明/提示

In the first example Polycarp will celebrate the equator on the evening of the second day, because up to this day (inclusive) he will solve 44 out of 77 scheduled problems on four days of the training.

In the second example Polycarp will celebrate the equator on the evening of the third day, because up to this day (inclusive) he will solve 66 out of 1212 scheduled problems on six days of the training.

在第一个例子中,Polycarp 将在第二天晚上庆祝“赤道日”,因为截至这一天(含当天),他在训练的四天内共解出了计划的 77 道题中的 44 道。

在第二个例子中,Polycarp 将在第三天晚上庆祝“赤道日”,因为截至这一天(含当天),他在训练的六天内共解出了计划的 1212 道题中的 66 道。

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

首页