#P3926. SAC E#1 - 一道不可做题 Jelly
SAC E#1 - 一道不可做题 Jelly
Description
SOL 君 likes eating konjac jelly, and SOL 菌 also likes konjac jelly.
One day, they were playing Hearthstone together, and SOL 菌 was going to serve konjac jelly to his guest.
Konjac jelly is usually stored in a refrigerator at degrees. However, it is too cold right after being taken out and needs to be heated. SOL 菌 plans to heat the konjac jelly with a magical electric stove. According to observation, it has the following behavior:
- When the jelly is below degrees, it heats by degree every units of time.
- When the jelly is exactly degrees, it needs units of time to thaw (everyone knows that during a phase change the temperature does not change... SOL 菌 believes jelly is crystalline).
- After thawing is complete, it heats by degree every units of time.
SOL wants to know the temperature of the jelly after heating for units of time.
The temperature is floored. That is, if the heating ends with less than (or ) units of time, then during this final short period the temperature does not change at all.
Input Format
The input contains a single line with integers: .
Output Format
Output a single integer: the required temperature.
-10 0 2 1 3 26
1
-10 0 2 1 3 27
2
Hint
For of the testdata, , .
For of the testdata, , .
For of the testdata, , .
The testdata may have , which should be considered as the not-yet-thawed state.
Hint: Please use the long long data type.
Translated by ChatGPT 5
京公网安备 11011102002149号