Codeforces Round #443 (Div. 2), problem: (B) Table Tennis Solution In C/C++

By |2017-11-08T09:22:14+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , |

#include <iostream> using namespace std; int main() { long long n,k,a,m=0,ab=0; cin>>n>>k>>ab; while(--n){ cin>>a; if(m==k){break;} if(ab>a){m++;} else ab=a,m=1; } cout<<ab; }