1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <iostream>
using namespace std;
int n,k,maks,a,l;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
cin>>maks;
for(int i=2; i<=n; i++)
{
if(i<=k) {
l=i-2;
for(int j=1; j<=i; j++)
{
cin>>a;
if(j==0||j==i)
{
if(a<maks)
maks=a;
}
else if(i+l<=k)
{
if(a<maks)
maks=a;
l-=2;
}
}
}
}
cout<<maks;
return 0;
}
|