1 2 3 | 2 2 1 99 100 0 |
大专栏 Dragonsre>
- output:
- YES
- input:
1 2 | 10 1 100 100 |
- output:
- NO
- Note:
In the first sample Kirito's strength initially equals 2. As the first dragon's strength is Less than 2, Kirito can fight it and defeat it. After that he gets the bonus and his strength increases to 2?+?99?=?101. Now he can defeat the second dragon and move on to the next level.
In the second sample Kirito's strength is too small to defeat the only dragon and win.
題意:
給你一開始的力量跟每頭龍的力量和打倒後增加的力量, 當你的力量大於龍的力量時可以打倒他並增加力量, 問你能不能打倒所有龍?
思路:
從力量小的龍開始打, 能打到最後就可以, 否則不行.
程式碼:
題目網址 https://codeforces.com/problemset/problem/230/A
来源: http://www.bubuko.com/infodetail-3327488.html