結果

問題 No.564 背の順
ユーザー tenkyu9
提出日時 2018-03-06 06:40:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-14 14:54:22
合計ジャッジ時間 1,428 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long int ll;

int main(){

  int h[100], n, H;
  cin >> h[0] >> n;
  H=h[0];
  for(int i=1; i<n; i++){
    cin >> h[i];
  }
  n++;
  sort(h, h+n);
  for(int i=0; i<n; i++){
    if(H==h[i]){
      if(n-i==1){
        cout << 1 << "st" << endl;
        return 0;
      } else if(n-i==2){
        cout << 2 << "nd" << endl;
        return 0;
      } else if(n-i==3){
        cout << 3 << "rd" << endl;
        return 0;
      } else {
        cout << n-i << "th" << endl;
        return 0;
      }
    }
  }

  return 0;
}
0