#include <cstdio> int n,k, wyn = 2019, pom; int main() { scanf("%d%d", &n, &k); for(int i = 1; i <= n; i++) for(int j = i; j >= 1; j--) { scanf("%d", &pom); if(pom < wyn && j * (i - j + 1) <= k) wyn = pom; } printf("%d\n", wyn); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <cstdio> int n,k, wyn = 2019, pom; int main() { scanf("%d%d", &n, &k); for(int i = 1; i <= n; i++) for(int j = i; j >= 1; j--) { scanf("%d", &pom); if(pom < wyn && j * (i - j + 1) <= k) wyn = pom; } printf("%d\n", wyn); } |