#include <cstdio> using namespace std; int main() { int n, k; int min = 2020; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) { int row = i + 1; for (int j = 0; j <= i; j++) { int in_row = j + 1; int x; scanf("%d", &x); int removes = in_row * (row - in_row + 1); if (removes <= k) { if (x < min) min = x; } } } printf("%d", min); }
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> using namespace std; int main() { int n, k; int min = 2020; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) { int row = i + 1; for (int j = 0; j <= i; j++) { int in_row = j + 1; int x; scanf("%d", &x); int removes = in_row * (row - in_row + 1); if (removes <= k) { if (x < min) min = x; } } } printf("%d", min); } |