CF6C.Alice, Bob and Chocolate
普及-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
爱丽丝和鲍勃喜欢玩游戏。现在,他们准备开始一个新游戏。他们将 n 块巧克力排成一行。爱丽丝从左到右依次吃巧克力,而鲍勃则从右到左依次吃。每块巧克力被吃掉所需的时间已知(爱丽丝和鲍勃的进食速度相同)。当一名玩家吃完一块巧克力后,会立即开始吃下一块。不允许同时吃两块巧克力、中途放弃某块巧克力,或中途暂停。如果两名玩家同时开始吃同一块巧克力,则鲍勃作为真正的绅士,会把这块巧克力让给爱丽丝。
请问:每名玩家各将吃掉多少块巧克力?
输入格式
The first line contains one integer n (1 ≤ n ≤ 105) — the amount of bars on the table. The second line contains a sequence _t_1, _t_2, ..., t__n (1 ≤ t__i ≤ 1000), where t__i 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 表示爱丽丝消耗的巧克力棒数量,b 表示鲍勃消耗的巧克力棒数量。
输入输出样例
输入#1
5 2 9 8 2 7
输出#1
2 3
输入解题思路,AI测评打分。不知道怎么写?