結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  himo | 
| 提出日時 | 2019-09-18 18:51:08 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 503 bytes | 
| コンパイル時間 | 1,544 ms | 
| コンパイル使用メモリ | 163,672 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 13:19:19 | 
| 合計ジャッジ時間 | 2,092 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main(){
int hito,n;
cin >> hito >>n;
vector<int>a(n);
for(int i=0;i<n;i++){
    cin >> a.at(i);
}
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
int ans =0;
for(int i=0;i<n;i++){
    if(hito>=a.at(i)){
        ans=i+1;
        break;
    }
}
string che =to_string(ans);
if(che.back()=='1')cout <<che<<"st"<<endl;
else if(che.back()=='2')cout <<che<<"nd"<<endl;
else if(che.back()=='3')cout <<che<<"rd"<<endl;
else{
    cout <<che<<"th"<<endl;
}
}
            
            
            
        