#include <cstdio> using namespace std; int ile, pro, wyn = 2020, obec; int main() { scanf ("%d%d", &ile, &pro); for (int i = 0; i < ile; i++) { for (int j = 0; j < i + 1; j++) { scanf ("%d", &obec); if ((i + 1 - j) * (j + 1) <= pro) { if (obec < wyn) { wyn = obec; } } } } printf ("%d", wyn); 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 | #include <cstdio> using namespace std; int ile, pro, wyn = 2020, obec; int main() { scanf ("%d%d", &ile, &pro); for (int i = 0; i < ile; i++) { for (int j = 0; j < i + 1; j++) { scanf ("%d", &obec); if ((i + 1 - j) * (j + 1) <= pro) { if (obec < wyn) { wyn = obec; } } } } printf ("%d", wyn); return (0); } |