結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-09-08 22:44:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 659 bytes |
コンパイル時間 | 1,485 ms |
コンパイル使用メモリ | 160,096 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 05:35:51 |
合計ジャッジ時間 | 2,094 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; int H, n, h[102]; int main() { cin >> H >> n; h[0] = H; for (int i = 0; i < n - 1; ++i) { cin >> h[i + 1]; } sort(h, h + n, greater<int>()); for (int i = 0; i < n; ++i) { if (h[i] == H) { if (i == 0) { cout << "1st" << endl; } else if (i == 1) { cout << "2nd" << endl; } else if (i == 2) { cout << "3rd" << endl; } else { cout << i + 1 << "th" << endl; } return 0; } } return 0; }