#include <cstdio> int main(int argc, char* argv[]) { int n, k; scanf("%d %d", &n, &k); int curr; int ans = 0x7FFF7FFF; for(int i=0; i<n; i++) { for(int j=0; j<=i; j++) { scanf("%d", &curr); if(curr < ans && (i-j+1)*(j+1)<=k) ans = curr; } } printf("%d\n", ans); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <cstdio> int main(int argc, char* argv[]) { int n, k; scanf("%d %d", &n, &k); int curr; int ans = 0x7FFF7FFF; for(int i=0; i<n; i++) { for(int j=0; j<=i; j++) { scanf("%d", &curr); if(curr < ans && (i-j+1)*(j+1)<=k) ans = curr; } } printf("%d\n", ans); return 0; } |