#include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,m=1000000,a; scanf("%d%d",&n,&k); for (i=1;i<=n;++i) { for (j=1;j<=i;++j) { scanf("%d",&a); if (j*(i-j+1)<=k) m=min(m,a); } } printf("%d",m); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<bits/stdc++.h> using namespace std; int main() { int n,k,i,j,m=1000000,a; scanf("%d%d",&n,&k); for (i=1;i<=n;++i) { for (j=1;j<=i;++j) { scanf("%d",&a); if (j*(i-j+1)<=k) m=min(m,a); } } printf("%d",m); } |