結果

問題 No.564 背の順
ユーザー cwwcww
提出日時 2017-09-08 23:00:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 169,460 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:54:17
合計ジャッジ時間 2,222 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int H, N;
    cin >> H >> N;
    vector<int> vc;
    vc.emplace_back( H );
    int height;
    REP( i, N - 1 )
    {
        cin >> height;
        vc.emplace_back( height );
    }
    sort( ALL( vc ), greater<int>() );
    REP( i, N )
    {
        if( vc[ i ] == H )
        {
            string S = to_string( i + 1 );
            cout << S[ S.size() - 1 ];
            cout << ( S[ S.size() - 1 ] == 1 ? "st" : S[ S.size() - 1 ] == 2 ? "nd" : S[ S.size() - 1 ] == 3 ? "rd" : "th" ) << endl;
            return 0;
        }
    }
    return 0;
}
0