結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-11-21 02:13:42 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 503 bytes | 
| コンパイル時間 | 2,025 ms | 
| コンパイル使用メモリ | 172,492 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-08 05:26:54 | 
| 合計ジャッジ時間 | 2,514 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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;
}
}
            
            
            
        