結果

問題 No.564 背の順
ユーザー mmn15277198mmn15277198
提出日時 2020-06-05 19:27:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 87,604 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 16:25:11
合計ジャッジ時間 1,830 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;

int main(){
	int h,n;
	cin >> h >> n;
	vector<int> a;
	a.push_back(h);
	for(int i=0;i<n-1;i++){
		int temp;
		cin >> temp;
		a.push_back(temp);
	}
	sort(a.begin(),a.end(),greater<int>());
	for(int i=0;i<n;i++){
		if(a[i]==h){
			cout << i+1;
			if(i+1==1){
				cout << "st" << endl;
				return 0;
			}else if(i+1==2){
				cout << "nd" << endl;
				return 0;
			}else if(i+1==3){
				cout << "rd" << endl;
				return 0;
			}else{
				cout << "th" << endl;
				return 0;
			}
		}
	}
	return 0;
}

0