[BOJ 9848] Gift

View as PDF

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 512M

Problem type
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

The coach of Jacqueline Yo, Olympic swimmer for Singapore, is concerned about her Butterfly stroke. He records her daily timing in milliseconds (a millisecond is onethousand of a second) and devises a scheme whereby each time she achieves a timing that is lower than the previous day’s timing by at least a certain number of milliseconds, he will reward her with a small encouragement gift.</p>

Given a list of daily timings, determine how many gifts Jacqueline would have received.

입력 형식

The first line contains 2 integers n and k, where n (3 ≤ n ≤ 100) is the number of days, and k (0 < k ≤ 100,000) the desired improvement (in milliseconds). Whenever Jacqueline’s timing reduces by at least k milliseconds over the previous day’s timing, she will receive a gift from her coach. The first line is then followed by n lines where each line contains a single integer t (0 < t ≤ 100,000) which is Jacqueline’s daily timing in milliseconds. The n timing records are listed in chronological order.

출력 형식

The output consists of a single integer that indicates the number of gifts Jacqueline would have received.

예제 입력

6 100
59420
59410
59310
59290
59470
59350

예제 출력

2

Comments

There are no comments at the moment.