#abc376a. A - Candy Button
A - Candy Button
Score : points
问题陈述
有一个神秘的按钮。当你按下这个按钮时,你会得到一颗糖果,除非你距离上次得到糖果的时间还不到 秒。
高桥决定按下这个按钮 次。他将在从现在开始的 秒时按下第 次按钮。
他将得到多少颗糖果?
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There is a mysterious button. When you press this button, you receive one candy, unless less than seconds have elapsed since you last received a candy.
Takahashi decided to press this button times. He will press the button for the -th time seconds from now.
How many candies will he receive?
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the number of candies that Takahashi will receive.
Sample Input 1
6 5
1 3 7 8 10 12
Sample Output 1
3
Takahashi will press the button six times.
- 1st press ( second from now): You always receive a candy when pressing the button for the first time.
- 2nd press ( seconds from now): seconds have elapsed since he last received a candy, so he does not receive a candy.
- 3rd press ( seconds from now): seconds have elapsed since he last received a candy, so he receives a candy.
- 4th press ( seconds from now): second has elapsed since he last received a candy, so he does not receive a candy.
- 5th press ( seconds from now): seconds have elapsed since he last received a candy, so he does not receive a candy.
- 6th press ( seconds from now): seconds have elapsed since he last received a candy, so he receives a candy.
Therefore, he receives three candies.
Sample Input 2
3 2
0 2 4
Sample Output 2
3
Sample Input 3
10 3
0 3 4 6 9 12 15 17 19 20
Sample Output 3
7