02.13 Alice, Bob and Chocolate

Alice, Bob and Chocolate | JXNUOJicon-default.png?t=M0H8https://acs.jxnu.edu.cn/problem/CF6C

描述:

Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from right to left. For each chocololate bar the time, needed for the player to consume it, is known (Alice and Bob eat them with equal speed). When the player consumes a chocolate bar, he immediately starts with another. It is not allowed to eat two chocolate bars at the same time, to leave the bar unfinished and to make pauses. If both players start to eat the same bar simultaneously, Bob leaves it to Alice as a true gentleman.

How many bars each of the players will consume?

Alice和Bob都喜欢游戏。现在他们准备开始一个新的游戏。他们在一条线上放了n个巧克力。Alice从左边到右边一个一个吃巧克力,Bob从右边往左边开始。对于每个巧克力,玩家食用的时间是已知的(已知,Alice和Bob吃巧克力的速度是相等的)当玩家吃完一个巧克力棒时,会立即开始吃下一个。不允许同时吃两个巧克力棒使巧克力棒未完成或者暂停。如果两个玩家同时开始吃同一个巧克力棒,Bob会很绅士的将其给Alice吃。

每个玩家将会吃多少个?

输入:

The first line contains one integer n (1 ≤ n ≤ 105) — the amount of bars on the table. The second line contains a sequence t1, t2, ..., tn (1 ≤ ti ≤ 1000), where ti is the time (in seconds) needed to consume the i-th bar (in the order from left to right).

第一行驶入包含一个整数n(1 ≤ n ≤ 105)——在桌子上的巧克力数。第二行包含一列数t1,t2,...,tn(1 ≤ ti ≤ 1000),ti表示吃第i个巧克力棒所需要的时间,单位为秒,从左往右的顺序。

输出:

Print two numbers a and b, where a is the amount of bars consumed by Alice, and b is the amount of bars consumed by Bob.

输出两个数据a和b,a表示Alice吃的巧克力棒数,b表示Bob吃的巧克力数。

样例输入:

5
2 9 8 2 7

样例输出:

2 3
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值