#include <cstdio> #include <algorithm> int main() { int n, k; scanf("%d %d", &n, &k); int m = 3000; for (int r = 1; r <= n; r++) { for (int c = 1; c <= r; c++) { int a; scanf("%d", &a); if (c * (r - c + 1) <= k) { m = std::min(m, a); } } } printf("%d\n", m); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <cstdio> #include <algorithm> int main() { int n, k; scanf("%d %d", &n, &k); int m = 3000; for (int r = 1; r <= n; r++) { for (int c = 1; c <= r; c++) { int a; scanf("%d", &a); if (c * (r - c + 1) <= k) { m = std::min(m, a); } } } printf("%d\n", m); } |