#include<bits/stdc++.h> using namespace std; int y, n, k, odp = 20190; int main() { scanf("%d%d", &n, &k); int a = 1, b = 1; for(int lvl = 1; lvl <= n; ++lvl) { b = lvl; a = 1; for(int i = 1; i <= lvl; ++i) { scanf("%d", &y); int ile = a*b; if(ile <= k) odp = min(odp, y); --b; ++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 | #include<bits/stdc++.h> using namespace std; int y, n, k, odp = 20190; int main() { scanf("%d%d", &n, &k); int a = 1, b = 1; for(int lvl = 1; lvl <= n; ++lvl) { b = lvl; a = 1; for(int i = 1; i <= lvl; ++i) { scanf("%d", &y); int ile = a*b; if(ile <= k) odp = min(odp, y); --b; ++a; } } printf("%d\n", odp); } |