結果

問題 No.564 背の順
ユーザー Hoget157Hoget157
提出日時 2017-09-08 22:23:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,041 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 167,788 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-07 08:23:15
合計ジャッジ時間 2,147 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

void print(int num){
	if(num % 10 == 1) cout << num << "st" << endl;
	else if(num % 10 == 2) cout << num << "nd" << endl;
	else if(num % 10 == 3) cout << num << "rd" << endl;
	else cout << num << "th" << endl;
}

signed main(){
	int n,h[1000],x;
	cin >> h[0] >> n;
	x = h[0];
	for(int i = 1;i < n;i++) cin >> h[i];
	sort(h,h + n,greater<int>());
	for(int i = 0;i < n;i++){
		if(h[i] == x){
			print(i + 1);
			return 0;
		}
	}
	return 0;
}
0