#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;
int n,k;
int main()
{
scanf("%d %d", &n, &k);
int best = 2019;
for (int w=1; w<=n; w++) {
for (int x=1; x<=w; x++) {
int rok;
scanf("%d", &rok);
int nad = x*(w-x+1);
if (nad <= k && rok < best) {
best = rok;
}
}
}
printf("%d\n", best);
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 | #include <stdio.h> #include <string.h> #include <stdlib.h> typedef long long ll; int n,k; int main() { scanf("%d %d", &n, &k); int best = 2019; for (int w=1; w<=n; w++) { for (int x=1; x<=w; x++) { int rok; scanf("%d", &rok); int nad = x*(w-x+1); if (nad <= k && rok < best) { best = rok; } } } printf("%d\n", best); return 0; } |
English