如题,我写的read虽然读不了long long的数据,但是也可以读入啊。求大佬指点一下,这些改成cin输入都可以。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,w;
int a[100005];
inline ll read(){
char ch;
ll res=0;
ch=getchar();
while(ch>='0'&&ch<='9'){
res=res*10+ch-'0';
ch=getchar();
}
return res;
}
void count(int p,int all){
priority_queue <int> q;
for(int i=1;i<=all;i++){
q.push(a[i]);
}
while(p>1){
q.pop();
p--;
}
cout<<q.top()<<" ";
}
int main(){
// freopen("live.in","r",stdin);
// freopen("live.out","w",stdout);
n=read();
w=read();
int p;
for(int i=1;i<=n;i++){
a[i]=read();
p=i*w/100;
p=max(1,p);
count(p,i);
}
fclose(stdin);
fclose(stdout);
return 0;
}