結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  jellyfish_26 | 
| 提出日時 | 2017-09-12 15:51:55 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 603 bytes | 
| コンパイル時間 | 1,804 ms | 
| コンパイル使用メモリ | 162,260 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 17:21:52 | 
| 合計ジャッジ時間 | 2,062 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
int main() {
  int H,N;
  std::cin >> H >> N;
  std::priority_queue <int> high;
  high.push(H);
  int Ha;
  for(int a = 2; a <= N; ++a) {
    std::cin >> Ha;
    high.push(Ha);
  }
  int ans = 0;
  while(!high.empty()) {
    if(high.top() == H) {
      ++ans;
      break;
    }else{
      ++ans;
    }
    high.pop();
  }
  if(ans % 10 == 1) std::cout << ans << "st" << std::endl;
  if(ans % 10 == 2) std::cout << ans << "nd" << std::endl;
  if(ans % 10 == 3) std::cout << ans << "rd" << std::endl;
  if(ans % 10 >= 4 || ans % 10 == 0) std::cout << ans << "th" << std::endl;
}
            
            
            
        