AC
2024-03-23 09:58:24
发布于:广东
7阅读
0回复
0点赞
#include<bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long l;
queue<l>q;
l a[100001];
int main()
{
l n,k;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>a[i];
q.push(a[i]);
}
int first_num = q.front();
q.pop();
int cnt = 1;
while(cnt <= k)
{
if(first_num > q.front())
{
cnt++;
q.push(q.front());
q.pop();
}
else if(first_num < q.front())
{
cnt=1;
q.push(first_num);
first_num = q.front();
}
}
cout<<first_num;
return 0;
}
这里空空如也
有帮助,赞一个