#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
size_t n, k;
cin >> n >> k;
int result = INT_MAX;
for(size_t i = 1; i <= n; i++)
for(size_t j = 1; j <= i; j++)
{
int a;
cin >> a;
if(j*(i-j+1) <= k)
result = min(result, a);
}
cout << result << '\n';
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); size_t n, k; cin >> n >> k; int result = INT_MAX; for(size_t i = 1; i <= n; i++) for(size_t j = 1; j <= i; j++) { int a; cin >> a; if(j*(i-j+1) <= k) result = min(result, a); } cout << result << '\n'; } |
English