CF6C--Alice, Bob and Chocolate翻译
2022/2/10 6:13:39
本文主要是介绍CF6C--Alice, Bob and Chocolate翻译,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
原题链接--
https://acs.jxnu.edu.cn/problem/CF6Chttps://acs.jxnu.edu.cn/problem/CF6C
Alice, Bob and Chocolate
2000ms 65536K
描述:
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 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是爱丽丝吃的巧克力棒的数量,b是鲍勃吃的巧克力棒的数量。
样例输入:
5 2 9 8 2 7
样例输出:
2 3
这篇关于CF6C--Alice, Bob and Chocolate翻译的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15PingCAP 黄东旭参与 CCF 秀湖会议,共探开源教育未来
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升