测试数据8:
in:
10000 999
1.00
1.00
1.00
1.00
1.00
1.00
1.00
1.00
1.00
...
out:
1.00
我的答案:1.01
为什么不算对呢?
系统的解释:Wrong Answer.wrong answer The answer is wrong: expected = 1.000000, found = 1.010000
附上程序:
#include <bits/stdc++.h>
using namespace std;
const long long int maxn=10000000+7;
int n,k;
double l[maxn];
int main(){
cin>>n>>k;
for(int i=1;i<=n;++i)cin>>l[i];
long long int mid,s=0,e=maxn-7,ans=0;
while(s<e){
int sum=0;
mid=(s+e)/2;
for(int i=1;i<=n;++i){
sum+=(l[i]*100)/mid;
}
if(sum>=k){
s=mid+1;
}
else if(sum<k){
e=mid;
}
}
printf("%.2lf\n",(double)((mid*1.0)/(100*1.0)));
return 0;
}