結果

問題 No.564 背の順
ユーザー soragsorag
提出日時 2022-08-09 12:05:22
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 854 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 102,372 KB
最終ジャッジ日時 2023-10-19 22:25:42
合計ジャッジ時間 1,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:21:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   21 |     sort(a.begin(),a.end(),greater<>());
      |     ^~~~
      |     sqrt

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    ll h,n;
    ll ans=0;
    cin>>h>>n;
    vector<ll> a(n);
    for(int i=0;i<n-1;i++){
        cin>>a[i];
    }
    a[n-1]=h;
    sort(a.begin(),a.end(),greater<>());
    for(int i=0;i<n;i++){
        if(a[i]==h) ans=i+1;
    }
    if(ans<10){
    if(ans==1) cout<<ans<<"st"<<endl;
    else if(ans==2) cout<<ans<<"nd"<<endl;
    else if(ans==3) cout<<ans<<"rd"<<endl;
    else cout<<ans<<"th"<<endl;
    }
    else{
       
        if(ans%10==1) cout<<ans<<"st"<<endl;
        else if(ans%10==2) cout<<ans<<"nd"<<endl;
        else if(ans%10==3) cout<<ans<<"rd"<<endl;
        else cout<<ans<<"th"<<endl;
    }
    
    
    return 0;
}
     


0