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 n days, all days are numbered from 1 to n, beginning from the first.
On the i-th day Polycarp will necessarily solve ai 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 为自己制定了编程竞赛训练计划。他将进行 n 天的训练,所有天数从 1 到 n 编号,从第一天开始。
在第 i 天,Polycarp 必定会解决 ai 道题目。某天晚上,Polycarp 计划庆祝“赤道日”(equator)。他将在满足如下条件的最早一天的晚上庆祝:从训练开始到该天(含)为止,他所解决的题目总数达到全部题目总数的一半或更多。
请确定 Polycarp 庆祝赤道日的那天的编号(即天数索引)。
输入格式
The first line contains a single integer n (1≤n≤200000) — the number of days to prepare for the programming contests.
The second line contains a sequence a1,a2,…,an (1≤ai≤10000), where ai equals to the number of problems, which Polycarp will solve on the i-th day.
第一行包含一个整数 n(1≤n≤200000)—— 表示为编程竞赛做准备的天数。
第二行包含一个序列 a1,a2,…,an(1≤ai≤10000),其中 ai 表示 Polycarp 在第 i 天将要解决的问题数量。
输出格式
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 4 out of 7 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 6 out of 12 scheduled problems on six days of the training.
在第一个例子中,Polycarp 将在第二天晚上庆祝“赤道日”,因为截至这一天(含当天),他在训练的四天内共解出了计划的 7 道题中的 4 道。
在第二个例子中,Polycarp 将在第三天晚上庆祝“赤道日”,因为截至这一天(含当天),他在训练的六天内共解出了计划的 12 道题中的 6 道。
输入解题思路,AI测评打分。不知道怎么写?