結果

問題 No.564 背の順
ユーザー 西尾西尾
提出日時 2017-09-12 16:41:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 59,096 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 07:06:20
合計ジャッジ時間 1,058 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 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 #

//No.564 背の順

#include <iostream>
#include <algorithm>
using namespace std;

namespace
{
int H[ 110 ];
}

int main()
{
int i;
int iNama;
int N;
int iCount;

	cin >> iNama;
	cin >> N;
	for( i = 0; i < N - 1; i++ )
		cin >> H[ i ];

	sort( H, H + ( N - 1 ) );

	for( i = 0; i < N - 1; i++ )
	{
		if( iNama < H[ i ] ) break;
	}

	iCount = N - i;

	i = iCount % 10;
	if( i == 3 )
		cout << iCount << "rd" << endl;
	else if( i == 2 )
		cout << iCount << "nd" << endl;
	else if( i == 1 )
		cout << iCount << "st" << endl;
	else
		cout << iCount << "th" << endl;

	return 0;
}




0