#include <iostream> int main() { std::ios_base::sync_with_stdio(false); int n,k; uint64_t tmp1,best = UINT64_MAX; std::cin >> n >> k; for (int i = 0; i < n; ++i) for (int j = 0; j <= i; ++j) { std::cin >> tmp1; if ((1 + j) * (i + 1 - j) <= k) best = std::min(best, tmp1); } std::cout << best << std::endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> int main() { std::ios_base::sync_with_stdio(false); int n,k; uint64_t tmp1,best = UINT64_MAX; std::cin >> n >> k; for (int i = 0; i < n; ++i) for (int j = 0; j <= i; ++j) { std::cin >> tmp1; if ((1 + j) * (i + 1 - j) <= k) best = std::min(best, tmp1); } std::cout << best << std::endl; } |