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