题解

牛浩宇 · 发布于 2024-10-07 · 浏览 836 回复 1

include <bits/stdc++.h>

using namespace std;

int main() {

freopen("live.in", "r", stdin);
freopen("live.out", "w", stdout);
int n, w, f;
cin >> n >> w;
int a[605] = {0};
for (int i = 1; i <= n; i++) {
	cin >> f;
	a[f]++;
	int max = i * w / 100;
	if (max < 1){
			max = 1;
	}
	int c = 0;
	for (int j = 600; j >= 0; j--) {
		c += a[j];
		if (c >= max) {
			cout << j << " ";
			break;
		}
	}
}
return 0;

}

全部回复 共 1 条

  1. zxy0416 #1 ·

    freopen不注释掉吗

发表回复