#include<bits/stdc++.h> using namespace std; #define mp make_pair #define st first #define nd second #define pb push_back typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<long long, long long> pll; #define Q 1000000007 #define inf 1000000003 #define maxn 2003 int n, k; int odp=inf; int main(){ scanf("%d%d", &n, &k); for(int i=1; i<=n; i++){ for(int j=1; j<=i; j++){ int a; scanf("%d", &a); if(j*(i-j+1)<=k) odp=min(odp, a); } } printf("%d\n", odp); }
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 28 | #include<bits/stdc++.h> using namespace std; #define mp make_pair #define st first #define nd second #define pb push_back typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<long long, long long> pll; #define Q 1000000007 #define inf 1000000003 #define maxn 2003 int n, k; int odp=inf; int main(){ scanf("%d%d", &n, &k); for(int i=1; i<=n; i++){ for(int j=1; j<=i; j++){ int a; scanf("%d", &a); if(j*(i-j+1)<=k) odp=min(odp, a); } } printf("%d\n", odp); } |