// No.564 背の順 // https://yukicoder.me/problems/no/564 // #include #include #include using namespace std; int main() { int H, N; cin >> H >> N; vector heights; heights.push_back(H); for (auto i = 1; i < N; i++) { int tmp; cin >> tmp; heights.push_back(tmp); } sort(heights.begin(), heights.end()); auto it = lower_bound(heights.begin(), heights.end(), H); auto pos = N - (it - heights.begin()); cout << pos; switch (pos % 10) { case 1: cout << "st"; break; case 2: cout << "nd"; break; case 3: cout << "rd"; break; default: cout << "th"; break; } cout << endl; }