#include <iostream> //Kisielinski Damian using namespace std; int main(int argc, char** argv) { ios_base::sync_with_stdio(0); int n, k, b, x, min=2020; cin>>n>>k; for (int r = 1; r <= n; r++) { for (int p = 1; p <= r; p++) { cin>>b; x = (r+1-p)*p; if (x<=k && b < min) { min = b; } } } cout<<min<<endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> //Kisielinski Damian using namespace std; int main(int argc, char** argv) { ios_base::sync_with_stdio(0); int n, k, b, x, min=2020; cin>>n>>k; for (int r = 1; r <= n; r++) { for (int p = 1; p <= r; p++) { cin>>b; x = (r+1-p)*p; if (x<=k && b < min) { min = b; } } } cout<<min<<endl; return 0; } |