結果

問題 No.564 背の順
ユーザー Eclair1015Eclair1015
提出日時 2018-09-27 23:48:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 940 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 79,844 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 09:14:48
合計ジャッジ時間 1,144 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
using namespace std;
//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;

//grobal変数


int main() {
	int h, n;
	string s;
	cin >> h >> n;
	VI height(n-1);
	for (int i = 0; i < n-1; i++)cin >> height[i];
	int memo=-1;

	height.push_back(h);
	sort(height.begin(), height.end());
	reverse(height.begin(), height.end());

	/*for (int i = 0; i < n; i++) cout << height[i] << " ";
	cout << "\n";*/


	for (int i = 0; i < n; i++) {
		if (height[i] == h) {
			memo = i;
		}
	}
	memo++;
	if (memo % 10 == 1) {
		s = "st";
	}else if (memo % 10 == 2) {
		s = "nd";
	}else if (memo % 10 == 3) {
		s = "rd";
	}else {
		s = "th";
	}
	cout << memo << s << endl;
	return 0;

}
0