結果
問題 |
No.564 背の順
|
ユーザー |
|
提出日時 | 2017-09-17 20:35:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 836 ms |
コンパイル使用メモリ | 76,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 01:57:30 |
合計ジャッジ時間 | 1,411 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> int main() { int h, n; std::cin >> h >> n; std::vector<int> hi(n); hi[0] = h; for (int i = 1; i < n; i++) { std::cin >> hi[i]; } std::sort(hi.begin(), hi.end(), std::greater<int>()); int r = std::find(hi.begin(), hi.end(), h) - hi.begin() + 1; std::string s = std::to_string(r); if (r % 10 == 1) { s += "st"; } else if (r % 10 == 2) { s += "nd"; } else if (r % 10 == 3) { s += "rd"; } else { s += "th"; } std::cout << s << std::endl; }