結果

問題 No.564 背の順
ユーザー HankHank
提出日時 2017-09-08 23:25:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,006 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 90,080 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-07 08:34:21
合計ジャッジ時間 1,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll A, N;
  cin >> A >> N;
  vector<ll> H; H.pb(A);
  rep(i,N-1){ ll inp; cin >> inp; H.pb(inp);}
  sort(rall(H));

  rep(i,N){
    if(H[i]==A) {
      cout << i+1 ;
      if((i+1)%10==1) cout << "st" << endl;
      else if((i+1)%10==2) cout << "nd" << endl;
      else if((i+1)%10==3) cout << "rd" << endl;
      else cout << "th" << endl;
      return 0;
    }
  }
  
  return 0;
}
0