Cramming
Time limit1sMemory limit1024 MB
Given chapter study times, simulate 30-minute study blocks that cut off the current chapter when a block ends, and count chapters studied at least half.
- Level
Medium4 of 10
- Topics
- Simulation, Implementation, Math, Greedy
- Solved
- No attempts yet
Problem
Jihwan, who can leave his body at will, attended class but did not listen to the lecture. As always, exam period comes around, and Jihwan has only now started studying.
He has to study chapters in order, and studying the -th chapter takes minutes. But he does not have much time, so he cannot cover all of them. He has no choice but to use the cramming method to at least avoid an F.
The cramming method is to study for minutes, take a break, and then start studying for another minutes. As soon as he finishes studying a chapter completely, he starts studying the next chapter. The reason this method is called cramming is that there is one more important rule. moment the -minute study period ends, he slams the chapter he was studying shut and moves on!
Fortunately, before the exam he was able to study all chapters in order using the cramming method. Thinking it was easier than expected, Jihwan went straight out to drink. But perhaps this is the limit of the cramming method? Unfortunately, after drinking, everything except the chapters he had studied at least half of was erased from his head. Feeling dazed, Jihwan began counting how many chapters remained in his head. Help Jihwan, who is suffering from a hangover, by finding the number of chapters he studied at least half of.
Input
The first line gives . ()
From the second line, lines give the integer in order. ()
Output
Print the number of chapters Jihwan studied at least half of.