#include <iostream> #include <algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n, k; cin>>n>>k; int x=0, y=0, current_min=numeric_limits<int>::max()-1; while(x<n){ x ++; y = 1; int xi = x; while(xi>=1){ int b; cin>>b; int bx = (xi*y); if(bx<=k) current_min = min(b, current_min); xi--; y ++; } } cout<<current_min<<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <iostream> #include <algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n, k; cin>>n>>k; int x=0, y=0, current_min=numeric_limits<int>::max()-1; while(x<n){ x ++; y = 1; int xi = x; while(xi>=1){ int b; cin>>b; int bx = (xi*y); if(bx<=k) current_min = min(b, current_min); xi--; y ++; } } cout<<current_min<<endl; } |