結果

問題 No.564 背の順
ユーザー hotaka0213hotaka0213
提出日時 2019-05-05 19:12:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 62,932 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 18:56:46
合計ジャッジ時間 1,300 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <array>
using namespace std;
int main(){
int HiN,Nu;
cin>>HiN>>Nu;
Nu--;
int* NuO=new int[Nu];
int x=0,y=0;
while(x<Nu){
	cin>>NuO[x];
	x++;
}
sort(NuO,NuO+Nu,greater<int>());
x=0;
while(x==0){
	if(NuO[y]<=HiN){
		x++;
	}else{
		y++;
		if(y==Nu){
			x++;
		}
	}
}
y++;
switch(y%10){
	case 1: cout<<y<<"st"<<endl;  break;
	case 2: cout<<y<<"nd"<<endl;  break;
	case 3: cout<<y<<"rd"<<endl;  break;
	default: cout<<y<<"th"<<endl; break;
}
return 0;
}
0