結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  nanophoto12 | 
| 提出日時 | 2017-09-08 22:27:33 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,317 bytes | 
| コンパイル時間 | 1,225 ms | 
| コンパイル使用メモリ | 96,524 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 12:05:16 | 
| 合計ジャッジ時間 | 1,361 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
typedef tuple<double,int,int> t3;
using namespace std;
void solve()
{
    int h, n;
    cin >> h >> n;
    vector<int> v;
    v.emplace_back(h);
    for(int i = 2;i <= n;i++)
    {
        int hh;
        cin >> hh;
        v.emplace_back(hh);
    }
    sort(v.begin(), v.end());
    int index = 1;
    for(auto e = v.rbegin();e != v.rend();e++)
    {
        if(*e == h)
        {
            if(index % 10 == 1)
            {
                cout << index << "st" << endl;
                return;
            }
            if(index % 10 == 2)
            {
                cout << index << "nd" << endl;
                return;
            }
            if(index % 10 == 3)
            {
                cout << index << "rd" << endl;
                return;
            }
            cout << index << "th" << endl;
            return;
        }
        index++;
    }
    
}
int main()
{
    solve();
    return 0;
}
            
            
            
        