Valhalla Siege CodeForces - 975C (前缀合+二分)

博客描述了一个战斗模拟问题,Ivar的战士们在前线面对Lagertha的攻击。每个战士能承受不同数量的箭矢,Lagertha每分钟发射一定数量的箭。战士在全部阵亡后会复活并重新投入战斗。博客通过前缀和和二分查找算法解决每次攻击后存活战士的数量问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

C. Valhalla Siege
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.

Ivar has nn warriors, he places them on a straight line in front of the main gate, in a way that the ii-th warrior stands right after (i1)(i−1)-th warrior. The first warrior leads the attack.

Each attacker can take up to aiai arrows before he falls to the ground, where aiai is the ii-th warrior's strength.

Lagertha orders her warriors to shoot 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值