結果

問題 No.564 背の順
ユーザー kotamanegikotamanegi
提出日時 2017-09-08 22:28:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,278 bytes
コンパイル時間 1,054 ms
コンパイル使用メモリ 105,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:32:16
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int a, b;
	cin >> a >> b;
	vector<int> geko;
	geko.push_back(a);
	REP(i, b - 1) {
		int c;
		cin >> c;
		geko.push_back(c);
	}
	sort(geko.begin(), geko.end(), greater<int>());
	for (int i = 0;i < geko.size();++i) {
		if (geko[i] == a) {
			if (i%10 == 0) {
				cout << i+1<<"1st" << endl;
			}
			else if (i%10 == 1) {
				cout << i+1 <<"nd" << endl;
			}
			else if (i%10 == 2) {
				cout << i+1 << "rd" << endl;
			}
			else {
				cout << i + 1 << "th" << endl;
			}
			return 0;
		}
	}
}
0