Editorial for 仁慈的導師


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: a002

參考code

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

int main() {

    int n; cin >> n;
    vector<int> v(n);
    for(int i = 0;i < n;i++) {
        cin >> v[i];
    }

    int a, b; cin >> a >> b;

    sort(v.begin(), v.end(), greater<int>());

    int ans = 0;

    for(auto &i : v) {
        while(a && i < 60) {
            a--;
            i += 10;
        }
        if(b && i < 60) {
            i = 60;
            b--;
        }
        if(i < 60) ans++;
    }

    cout << ans;

    return 0;
}

Comments

There are no comments at the moment.