#P1867. 【Mc生存】经验值
【Mc生存】经验值
Description
It is said that clearman opened a Xiangyi cattle ranch in the MC world, using lava, TNT, and other brutal methods to torment cows, farming beef, milk, and experience. He wants to know what level he ultimately reaches.
He performs a total of operations. Each operation costs HP (initial HP is 10; calculate the HP cost first—if HP becomes less than or equal to 0, he dies, and this operation and all subsequent operations are invalid. Note: the HP cost can be negative, meaning he restores HP, but HP is capped at 10). Each operation grants experience points (cannot be negative). In the end, he will be at level with experience.
P.S. About levels:
- The initial level is . Every additional (where is the current level) experience points increases the level by 1.
- Example 1: If clearman gains a total of experience points, then he should be level with experience left ().
- Example 2: If clearman gains a total of experience points, then he should be level with experience left ().
Description
Input Format
The first line contains a positive integer , the number of operations.
The next lines each contain two integers and , representing one operation of clearman.
Output Format
Output one line with two integers: the final level and the remaining experience toward the next level, separated by a space.
2
5.5 15
4.5 24
4 0
Hint
The testdata is very weak and can be solved by hand, but it is tricky.
Constraints
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号