結果
問題 | No.564 背の順 |
ユーザー | pekempey |
提出日時 | 2017-09-08 22:23:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 679 ms |
コンパイル使用メモリ | 72,192 KB |
最終ジャッジ日時 | 2025-01-05 02:45:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int h, n; cin >> h >> n; int rank = 1; for (int i = 0; i < n - 1; i++) { int a; cin >> a; if (a > h) { rank++; } } cout << rank; if (rank % 10 == 1) { cout << "st"; } else if (rank % 10 == 2) { cout << "nd"; } else if (rank % 10 == 3) { cout << "rd"; } else { cout << "th"; } }