結果

問題 No.564 背の順
ユーザー hotaka0213
提出日時 2019-05-05 19:12:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 59,924 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 12:42:38
合計ジャッジ時間 1,106 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

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