1 条题解

  • 0
    @ 2026-1-7 18:32:20

    按题意直接模拟即可。

    AC code:

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        freopen("duel.in","r",stdin);
        freopen("duel.out","w",stdout);
        int n;
        cin >> n;
        vector<long long> r(n);
        for (int i = 0; i < n; ++i) {
            cin >> r[i];
        }
        sort(r.begin(), r.end());
        int left = 0, count = 0;
        for (int j = 1; j < n; ++j) {
            if (r[j] > r[left]) {
                ++left;
                ++count;
            }
        }
        cout << n - count << endl;
        return 0;
    }
    
    • 1

    信息

    ID
    90
    时间
    1000ms
    内存
    512MiB
    难度
    2
    标签
    递交数
    16
    已通过
    8
    上传者