#include <stdio.h> int main() { int n, k, i, j, x, y, z, r, w; while (scanf("%d%d", &n, &k)==2) { w = 3000; for (i=1; i<=n; i++) { x = 1; y = i; for (j=1; j<=i; j++) { scanf("%d", &r); if (r<w && x*y<=k) w = r; x++; y--; } } printf("%d\n", w); } return 0; }
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 | #include <stdio.h> int main() { int n, k, i, j, x, y, z, r, w; while (scanf("%d%d", &n, &k)==2) { w = 3000; for (i=1; i<=n; i++) { x = 1; y = i; for (j=1; j<=i; j++) { scanf("%d", &r); if (r<w && x*y<=k) w = r; x++; y--; } } printf("%d\n", w); } return 0; } |