結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
himo
|
| 提出日時 | 2019-09-18 18:47:30 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 494 bytes |
| 記録 | |
| コンパイル時間 | 1,390 ms |
| コンパイル使用メモリ | 163,808 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 13:14:35 |
| 合計ジャッジ時間 | 1,679 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 7 |
ソースコード
#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;
}
}
himo