#include <bits/stdc++.h> using namespace std; unsigned int a[2000][2000]; unsigned int blockers (unsigned int row, unsigned int pos) { return (pos + 1) * (row + 1 - pos) - 1; } int main (void) { unsigned int k, n; scanf ("%u %u", &n, &k); unsigned int best = 2137; for (unsigned int i = 0; i < n; i ++) for (unsigned int j = 0; j <= i; j ++) { unsigned int a; scanf ("%u", &a); if (blockers (i, j) < k) best = min (best, a); } printf ("%u\n", best); 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 24 25 26 27 28 29 30 31 32 33 34 35 | #include <bits/stdc++.h> using namespace std; unsigned int a[2000][2000]; unsigned int blockers (unsigned int row, unsigned int pos) { return (pos + 1) * (row + 1 - pos) - 1; } int main (void) { unsigned int k, n; scanf ("%u %u", &n, &k); unsigned int best = 2137; for (unsigned int i = 0; i < n; i ++) for (unsigned int j = 0; j <= i; j ++) { unsigned int a; scanf ("%u", &a); if (blockers (i, j) < k) best = min (best, a); } printf ("%u\n", best); return 0; } |