题目描述

代码如下:
'''
#include <iostream>
using namespace std;
int main() {
int n, time,days_can_dance=0;
cin >> n >> time;
int * dance = new int[n]();
for (int i = 0; i < n; i++)
{
cin >> dance[i];
}
int curr_date = time;
while (curr_date < n - time) {
int i = 0;
for (i = 0; i < time;) {
if (dance[curr_date - i] < dance[curr_date - i - 1] || dance[curr_date + i] < dance[curr_date + i + 1])break;
else i++;
}
if (i == time)days_can_dance++;
curr_date++;
}
cout << days_can_dance;
delete []dance;
}


输入格式


输出格式


样例数据

输入

7 2
3 5 5 5 3 2 6

输出

2

备注


操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解