#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); unsigned int n, k; short int chsn1=2020, foo; cin >> n >> k; for (int i=1; n>=i; i++){ for (int j=0; j<i; j++){ cin >> foo; if (k>=(i-j)*(j+1)&&foo<chsn1) chsn1=foo; } } cout << chsn1 << endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); unsigned int n, k; short int chsn1=2020, foo; cin >> n >> k; for (int i=1; n>=i; i++){ for (int j=0; j<i; j++){ cin >> foo; if (k>=(i-j)*(j+1)&&foo<chsn1) chsn1=foo; } } cout << chsn1 << endl; return 0; } |