#abc303f. F - Damage over Time
F - Damage over Time
Score : points
问题陈述
一个拥有 点生命值的怪物出现在你面前,一场回合制战斗开始了。
在每个回合 中,你可以施放 种法术中的任意一种,法术编号分别为 。
若你在第 回合施放了第 个法术,则在回合 中,怪物的生命值每回合减少 点。
请找出最早可以在哪个回合使怪物的生命值降至 或以下。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
A monster with health has appeared in front of you, and a turn-based battle has started.
In each turn , you cast one of spells, spells .
If you cast spell in turn , the monster's health reduces by in each turn .
Find the earliest turn that you can make the monster's health or less.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 20
2 2
5 1
Sample Output 1
6
The following procedure makes the monster's health or less in turn , which is the earliest.
- Cast spell in turn . Due to the spell cast in turn , the monster's health reduces by and becomes .
- Cast spell in turn . Due to the spells cast in turns and , the monster's health reduces by and becomes .
- Cast spell in turn . Due to the spells cast in turns and , the monster's health reduces by and becomes .
- Cast spell in turn . Due to the spells cast in turns and , the monster's health reduces by and becomes .
- Cast spell in turn . Due to the spells cast in turns and , the monster's health reduces by and becomes .
- Cast spell in turn . Due to the spells cast in turns and , the monster's health reduces by and becomes .
Sample Input 2
10 200
1 21
1 1
1 1
8 4
30 1
3 1
10 2
8 1
9 1
4 4
Sample Output 2
9
update @ 2024/3/10 08:32:11