結果

問題 No.564 背の順
ユーザー takiteketakiteke
提出日時 2017-09-09 01:09:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 79,496 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 03:00:50
合計ジャッジ時間 1,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int h, N;
	int H[102];
	cin >> h >> N;
	REP(i, N) {
		if (i == 0) {
			H[i] = h;
			continue;
		}
		cin >> H[i];
	}


	sort(H, H + N);

	//REP(i, N) {
	//	cout << H[i] << " ";
	//}
	//cout << endl;

	int a = 0;
	REP(i, N) {
		if (H[i] == h) a = i + 1;
	}
	//cout << a << endl;
	a = N - a + 1;
	//cout << a << endl;
	int b;
	if ((a - 1) % 10 == 0) b = 1;
	else if ((a - 2) % 10 == 0)b = 2;
	else if ((a - 3) % 10 == 0) b = 3;
	else b = 4;
	//cout << a << endl;
	cout << a << (b == 1 ? "st" : (b == 2 ? "nd" : (b == 3 ? "rd" : "th"))) << endl;
	return 0;
}
0