'commit'
This commit is contained in:
25
TangDou/CSP-J/MKX_B/3205.cpp
Normal file
25
TangDou/CSP-J/MKX_B/3205.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int n, w;
|
||||
const int N = 610;
|
||||
vector<int> f;
|
||||
int main() {
|
||||
//配置从文本文件读入数据
|
||||
freopen("live.in","r", stdin);
|
||||
freopen("live.out","w", stdout);
|
||||
//加快读入
|
||||
ios::sync_with_stdio(false), cin.tie(0);
|
||||
cin >> n >> w;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
int cnt = max(1, i * w / 100); //目前的获奖人数,10 100
|
||||
int x;
|
||||
cin >> x;
|
||||
// 用途:在一个用序的数组中, 插入一个新数,最终还要是一个有序的数组
|
||||
// 办法:vector插入排序 = 二分查找+vector插入
|
||||
//f.insert(upper_bound(f.begin(), f.end(), x), x);
|
||||
f.insert(lower_bound(f.begin(), f.end(), x), x);
|
||||
printf("%d ", f[i - cnt]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user