結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2019-09-18 18:48:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 1,564 ms |
コンパイル使用メモリ | 163,944 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 13:15:58 |
合計ジャッジ時間 | 2,053 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 <<che<<"st"<<endl; else if(che.at(0)=='2')cout <<che<<"nd"<<endl; else if(che.at(0)=='3')cout <<che<<"rd"<<endl; else{ cout <<che<<"th"<<endl; } }