P7072 [CSP-J2020] 直播获奖

P7072 [CSP-J2020] 直播获奖

 

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


const int maxn = 1e5 + 10;
int n,w,cnt[610] = { 0 };


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> w;
    int ans = 1;
    for(int i = 1; i <= n; i++){
        int t;cin >> t;cnt[t]++;
        ans = max(ans,(int)(w * i * 0.01));
        int s = 0;
        for(int j = 600; j >=0; j--){
            s += cnt[j];
            if(s >= ans) {
                cout << j <<" ";
                break;
            }
            
        }
    }
    

    return 0;
}
View Code

 

计数排序

posted @ 2025-09-17 09:14  Hazelxcf  阅读(4)  评论(0)    收藏  举报