跳到正文

题解

题解:P7072 [CSP-J2020] 直播获奖

Lpynb约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P7072

版本

  1. v1当前

参考代码:

C++
#include <iostream>
#include <cmath>
using namespace std;
int n, w, a[609],x;
int main()
{
    cin >> n >> w;
    for (int i = 1; i <= n; i++)
    {
        cin >> x;
        a[x] += 1;
        int t = max(1, (int)floor(i * w / 100));
        int cnt = 0;
        for (int j = 600; j >= 0; j--)
        {
            cnt += a[j];
            if (cnt >= t)
            {
                cout << j << " ";
                break;
            }
        }
    }
    return 0;
}
原文