結果

問題 No.564 背の順
ユーザー zaichu
提出日時 2017-10-08 23:31:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 172,484 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 05:50:59
合計ジャッジ時間 2,257 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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(), greater<int>());

    for (int i = 0; i < N; i++)
    {
        if (H[i] != h)
            continue;

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