#include <bits/stdc++.h> #define forn(I,P,K) for(int (I)=(P);(I)<=(K);++(I)) using namespace std; int main() { ios_base::sync_with_stdio(0); int n,k,w=2020,a; cin>>n>>k; forn(i,1,n) forn(j,1,i) { cin>>a; if(j*(i-j+1)<=k) w=min(w,a); } return cout<<w,0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <bits/stdc++.h> #define forn(I,P,K) for(int (I)=(P);(I)<=(K);++(I)) using namespace std; int main() { ios_base::sync_with_stdio(0); int n,k,w=2020,a; cin>>n>>k; forn(i,1,n) forn(j,1,i) { cin>>a; if(j*(i-j+1)<=k) w=min(w,a); } return cout<<w,0; } |