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