#include <cstdio> int read() { int n; scanf("%d", &n); return n; } int main() { int n = read(); int k = read(); int res = read(); for (int s=1; s<n; ++s) { for (int i=0; i<=s; ++i) { int j = s - i; int x = read(); if (x < res && (i+1) * (j+1) <= k) res = x; } } printf("%d\n", res); 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 | #include <cstdio> int read() { int n; scanf("%d", &n); return n; } int main() { int n = read(); int k = read(); int res = read(); for (int s=1; s<n; ++s) { for (int i=0; i<=s; ++i) { int j = s - i; int x = read(); if (x < res && (i+1) * (j+1) <= k) res = x; } } printf("%d\n", res); return 0; } |