結果

問題 No.564 背の順
ユーザー zaichuzaichu
提出日時 2017-10-08 23:09:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 172,240 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 13:37:09
合計ジャッジ時間 2,040 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long gcd(long long x, long long y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

long long lcm(long long x, long long y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

int main()
{
    int h, N;
    cin >> h >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++)
    {
        cin >> H[i];
    }
    H.push_back(h);
    N++;
    sort(H.begin(), H.end());
    for (int i = 0; i < N; i++)
    {
        if (H[i] != h)
            continue;

        if (i == 0)
            cout << "1st" << endl;
        else if (i == 1)
            cout << "2nd" << endl;
        else if (i == 2)
            cout << "3rd" << endl;
        else
            cout << i + 1 << "th" << endl;
        break;
    }
}
0