社区讨论
请问数据规模是不是有问题?
P7072[CSP-J 2020] 直播获奖参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @locyyx7o
- 此快照首次捕获于
- 2023/10/30 22:02 2 年前
- 此快照最后确认于
- 2023/11/05 08:23 2 年前
如题,我写的read虽然读不了long long的数据,但是也可以读入啊。求大佬指点一下,这些改成cin输入都可以。
CPP#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;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...