結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-12 18:08:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 649 bytes |
| コンパイル時間 | 785 ms |
| コンパイル使用メモリ | 74,868 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 05:52:48 |
| 合計ジャッジ時間 | 1,447 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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> a(N+1);
a[0] = H;
for (int i = 0; i < N - 1; ++i) {
int b;
std::cin >> b;
a[i + 1] = b;
}
std::sort(a.begin(), a.end(), std::greater<int>());
for (int i = 0; i < N; ++i) {
if (a[i] == H) {
std::cout << (i + 1);
if ((i + 1) % 10 == 1) {
std::cout << "st";
} else if ((i + 1) % 10 == 2) {
std::cout << "nd";
} else if ((i + 1) % 10 ==3) {
std::cout << "rd";
} else {
std::cout << "th";
}
std::cout << std::endl;
}
}
return 0;
}