結果

問題 No.564 背の順
ユーザー mas9612
提出日時 2019-08-05 20:33:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 54,024 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 13:41:31
合計ジャッジ時間 940 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
    int h, n;
    cin >> h >> n;

    int higher = 0;
    for (int i = 0; i < n - 1; ++i) {
        int height;
        cin >> height;

        if (height > h)
            ++higher;
    }

    int rank = higher + 1;
    cout << rank;
    int end = rank % 10;
    switch (end) {
        case 1:
            cout << "st\n";
            break;
        case 2:
            cout << "nd\n";
            break;
        case 3:
            cout << "rd\n";
            break;
        default:
            cout << "th\n";
            break;
    }
}
0