Gift
InterviewTime limit2sMemory limit512 MB
Count the days on which the recorded time is at least k milliseconds faster than the previous day.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
The coach of Jacqueline Yo, an Olympic swimmer for Singapore, is worried about her butterfly stroke. He writes down her timing every day in milliseconds, where a millisecond is one thousandth of a second. He promised her a small gift as encouragement on every day she beats the previous day's timing by at least a fixed number of milliseconds.
Given the daily timings, find how many gifts Jacqueline received.
Input
The first line contains two integers and . () is the number of days, and () is the improvement the coach asks for, in milliseconds. Jacqueline receives a gift on every day her timing drops by at least milliseconds compared with the previous day. Each of the next lines contains one integer (), her timing for that day in milliseconds. The records are given in chronological order.
Output
Print a single integer, the number of gifts Jacqueline received.