結果

問題 No.564 背の順
ユーザー himohimo
提出日時 2019-09-18 18:47:30
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 1,311 ms
コンパイル使用メモリ 149,648 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 22:29:59
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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.at(0)=='1')cout <<"1st"<<endl;
else if(che.at(0)=='2')cout <<"2nd"<<endl;
else if(che.at(0)=='3')cout <<"3rd"<<endl;
else{
    cout <<che.at(0)<<"th"<<endl;
}
}
0