mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 04:15:54 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+43
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _879B
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
long[] ip = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
|
||||
int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
if (ip[0] <= ip[1])
|
||||
{
|
||||
Console.Write("{0}", a.Max());
|
||||
}
|
||||
else
|
||||
{
|
||||
int c = 0;
|
||||
int t = a[0];
|
||||
for (int i = 1; i < ip[0]; i++)
|
||||
{
|
||||
if (c == ip[1])
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (t > a[i])
|
||||
{
|
||||
c++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 1;
|
||||
t = a[i];
|
||||
}
|
||||
}
|
||||
Console.Write(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user