#include <cstdio> int main () { int n, k, i, j, x; int oldest = 10000; scanf("%d %d", &n, &k); for (i = 1; i <= n; ++i) { for (j = 1; j <= i; ++j) { scanf("%d", &x); if (x > oldest) { continue; } if ((i - j + 1) * j > k) { continue; } oldest = x; } } printf("%d\n", oldest); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <cstdio> int main () { int n, k, i, j, x; int oldest = 10000; scanf("%d %d", &n, &k); for (i = 1; i <= n; ++i) { for (j = 1; j <= i; ++j) { scanf("%d", &x); if (x > oldest) { continue; } if ((i - j + 1) * j > k) { continue; } oldest = x; } } printf("%d\n", oldest); return 0; } |