#include <bits/stdc++.h>//Krzysztof Łukasiewicz
using namespace std;
typedef long long int LL;
typedef unsigned long long int uLL;
typedef unsigned int uint;
typedef long double ld;
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(0);
int n, k;
cin >> n >> k;
int ans = 1000000;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i; j++){
int a;
cin >> a;
int s = (i-j+1)*j;
if(s <= k){
ans = min(a, ans);
}
}
}
cout << ans << '\n';
return 0;
}
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 29 | #include <bits/stdc++.h>//Krzysztof Łukasiewicz using namespace std; typedef long long int LL; typedef unsigned long long int uLL; typedef unsigned int uint; typedef long double ld; int main(){ cin.tie(NULL); ios_base::sync_with_stdio(0); int n, k; cin >> n >> k; int ans = 1000000; for(int i = 1; i <= n; i++){ for(int j = 1; j <= i; j++){ int a; cin >> a; int s = (i-j+1)*j; if(s <= k){ ans = min(a, ans); } } } cout << ans << '\n'; return 0; } |
English