Balmer's Peak Theory
InterviewTime limit1sMemory limit1024 MB
Count the hours when the alcohol consumed in the last L hours keeps blood alcohol concentration between 0.129 and 0.138 until the test starts.
- Level
Easy3 of 10
- Topics
- Sliding window, Array
- Solved
- No attempts yet
문제
Balmer's Peak theory holds that a person whose blood alcohol concentration is in the range gains superhuman programming ability. Giryeong follows this theory, so until the coding test starts, he will try to keep his blood alcohol concentration in that range for as long as possible. Each hour he drinks a fixed amount of alcohol, and the alcohol he has consumed is broken down after a set amount of time. Find how long Giryeong can keep his blood alcohol concentration between and from now until the coding test. The concentration increase is calculated as the alcohol amount , and the initial blood alcohol concentration is .
입력
The first line contains the time remaining until the coding test and the duration of the alcohol intake, separated by a space.
The second line contains the alcohol amounts in the drinks, separated by spaces.
출력
Print the number of hours during which the blood alcohol concentration stays within .