結果

問題 No.564 背の順
ユーザー yukiteruyukiteru
提出日時 2017-10-08 10:37:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 798 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 80,372 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 13:22:51
合計ジャッジ時間 1,309 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000001;

using namespace std;



int main(void) {
	int H, n;
	int h[101];
	int p = 0;

	cin >> H >> n;
	FOR(i, 1, n-1) {
		cin >> h[i];
	}
	sort(h, h + n);

	RFOR(i, n-1, 1) {
		p++;
		if (H > h[i]) {
			break;
		}
		if (i == 1) {
			p = n;
			break;
		}
	}
	switch (p % 10) {
	case 1:
		cout << p << "st" << endl;
		break;
	case 2:
		cout << p << "nd" << endl;
		break;
	case 3:
		cout << p << "rd" << endl;
		break;
	default:
		cout << p << "th" << endl;
	}
	return 0;
}
0