結果

問題 No.564 背の順
ユーザー jellyfish_26jellyfish_26
提出日時 2017-09-12 15:51:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 162,264 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 07:06:06
合計ジャッジ時間 2,015 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0