#include <iostream> using namespace std; int main(int argc, char *argv[]) { long long n, k, t, m = 200000000000000000; cin>>n>>k; for(int i=1;i<n+1;i++){ for(int j=1;j<i+1;j++){ cin>>t; if(t<m && j*(i-j+1)<=k) { m=t; } } } cout<<m; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int main(int argc, char *argv[]) { long long n, k, t, m = 200000000000000000; cin>>n>>k; for(int i=1;i<n+1;i++){ for(int j=1;j<i+1;j++){ cin>>t; if(t<m && j*(i-j+1)<=k) { m=t; } } } cout<<m; return 0; } |