题目链接:http://codeforces.com/problemset/problem/50/D
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll unsigned long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
const int maxn =1e2+5;
const int mod=9999991;
const int ub=1e6;
const double e=2.7182818284590452353602874713527 ;
const double eps=0.000000001;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*
题目大意:给定若干点的位置,和一个爆炸中心点,
问如果要想使得其爆炸失败的概率满足不大于给定值/1000,
(爆炸失败指 的是小于k 个点爆炸),最小的半径应该是多少。
明显的二分性质,注意上界应该取半径平方距离最大值。
对于搜索到的半径长度,用一下dp,
设dp(i,j)代表前i个炸了j个的概率,转移方程很好求,
注意代码细节即可,这道题代码要是短能更短,两个套路组合用一下就行。
时间复杂度:O(T*n*n)T为迭代次数。
wa了六次,前几次dp式子想错了,后面的是处理细节的问题。
*/
int n,k,f,K;
double x0,y0,R;
double x[maxn],y[maxn],ep[maxn];
double dp[maxn][maxn];
inline double p(double x)
{
if(x<=R) return 1.0;
return exp(1.0-x*x/(R*R));
}
inline double compute(double x,double y)
{
return sqrt(x*x+y*y);
}
inline bool check(double r){
mst(dp,0),dp[0][0]=1.0,R=r;
for(int i=1;i<=n;i++) ep[i]=p(compute(x0-x[i],y0-y[i]));///爆炸的概率
for(int i=1;i<=n;i++){
dp[i][0]=dp[i-1][0]*(1-ep[i]);
for(int j=1;j<=i;j++)
dp[i][j]=ep[i]*dp[i-1][j-1]+(1.0-ep[i])*dp[i-1][j];
}
double ans=0.0;for(int i=0;i<k;i++) ans+=dp[n][i];
return ans<=f/1000.0;
}
int main()
{
scanf("%d",&n);
scanf("%d%d",&k,&f);
scanf("%lf%lf",&x0,&y0);
double l=0.0,r=0.0,ans;
for(int i=1;i<=n;i++){
scanf("%lf%lf",&x[i],&y[i]);
r=max(r,compute(x[i]-x0,y[i]-y0));
}
int T=100;
while(T--){
double mid=(l+r)/2.0;
if(check(mid)) {ans=mid;r=mid;}
else {l=mid;}
}
printf("%.9f\n",ans);
return 0;
}