0
已解决
王泽轩
资深天翼
资深天翼
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int pp;
double b[200001],l,q,t,v,a[200001];
long long n;
int cmp(double x,double y){
return x>y;
}
int main(){
cin>>n>>l>>v;
for(int i=1;i<=n;i++){
cin>>a[i];
sort(a+1,a+1+n,cmp);
b[0]=1/v;
for(int i=1;i<=n;i++){
b[i]=double(a[i])/v+b[i-1];
}
cin>>q;
while(q--){
cin>>t;
if(b[n]<=t){
cout<<-1<<endl;
continue;
}
int l=0,r=n,pp=0;
while(1<=r){
int mid=(l+r)>>1;
if(b[mid]>t){
pp=mid;
r=mid-1;
}
else{
l=mid+1;
}
}
cout<<pp;
}
return 0;
}
}
15分