結果

問題 No.564 背の順
ユーザー wightou
提出日時 2025-07-30 06:40:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 3,020 ms
コンパイル使用メモリ 278,496 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-07-30 06:41:00
合計ジャッジ時間 4,034 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

/////////////////// メイン ///////////////////

int main () {
  
  //////////////////// 入力 ////////////////////

  int h, n;
  cin >> h >> n;
  n--;

  vector<int> a(n);
  for (int i=0; i<n; i++) {
    cin >> a.at(i);
  }

  //////////////// 出力変数定義 ////////////////

  int result = 1;

  //////////////////// 処理 ////////////////////

  for (int i : a) {
    if (h<i) result++;
  }

  //////////////////// 出力 ////////////////////

  cout << result;
  if (result%10==1) cout << "st";
  else if (result%10==2) cout << "nd";
  else if (result%10==3) cout << "rd";
  else cout << "th";
  cout << endl;

  //////////////////// 終了 ////////////////////

  return 0;

}
0