結果

問題 No.564 背の順
ユーザー tenkyu9tenkyu9
提出日時 2018-03-06 06:40:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 78,244 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 16:16:16
合計ジャッジ時間 1,578 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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