#include <bits/stdc++.h> #define pb push_back using namespace std; int N,K,co,mini = 2020; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> N >> K; int pl,mi; for(int i = 1;i<=N;i++){ pl = 0; for(int j = 1;j<=i;j++){ cin >> co; if(K >= (i-pl)*j){ mini = min(mini,co); } pl++; } } cout << mini << '\n'; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> #define pb push_back using namespace std; int N,K,co,mini = 2020; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> N >> K; int pl,mi; for(int i = 1;i<=N;i++){ pl = 0; for(int j = 1;j<=i;j++){ cin >> co; if(K >= (i-pl)*j){ mini = min(mini,co); } pl++; } } cout << mini << '\n'; } |