//Bartek_Kolakowski #include <iostream> #include <cmath> #include <cstdio> using namespace std; int tab [2000100]; int main() { int n; cin >> n; int k; cin >> k; int x; x = (n*(n+1))/2; for (int i =1; i<= x; i++) { cin >> tab [i]; } int i =0; int y; y = 2020; do { i=i+1; int a; a =i; int b; b =i; for (a; a<= (b*(b+1))/2; a++ ) { //cout << tab [a]<<endl; if (tab [a] < y) { y = tab [a]; } } //cout << i << " "<< ((i*(i+1))/ 2) << endl; } while (k > ((i*(i+1))/ 2)); cout << y <<endl; 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | //Bartek_Kolakowski #include <iostream> #include <cmath> #include <cstdio> using namespace std; int tab [2000100]; int main() { int n; cin >> n; int k; cin >> k; int x; x = (n*(n+1))/2; for (int i =1; i<= x; i++) { cin >> tab [i]; } int i =0; int y; y = 2020; do { i=i+1; int a; a =i; int b; b =i; for (a; a<= (b*(b+1))/2; a++ ) { //cout << tab [a]<<endl; if (tab [a] < y) { y = tab [a]; } } //cout << i << " "<< ((i*(i+1))/ 2) << endl; } while (k > ((i*(i+1))/ 2)); cout << y <<endl; return 0; } |