結果

問題 No.564 背の順
ユーザー takiteketakiteke
提出日時 2017-09-08 22:50:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 826 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 79,084 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:48:49
合計ジャッジ時間 1,129 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 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 << (a==1?"st":(a==2?"nd":(a==3?"rd":"th"))) << endl;
	return 0;
}
0