纯污染无天然的暴力题,本地过了,为什么评测全wa?
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
double compute_dis(ll x,ll y,ll a,ll b){
double ans=sqrt(pow(x-a,2)+pow(y-b,2));
return ans;
}
int main(){
scanf("%d",&n);
vector<ll>x(n+10);
vector<ll>y(n+10);
double dis,min_dis=1e12;
for(ll i=1;i<=n;i++){
scanf("%d%d",&x[i],&y[i]);
}
for(ll i=1;i<=n;i++){
for(ll j=i+1;j<=n;j++){
dis=compute_dis(x[i],y[i],x[j],y[j]);
if(dis<min_dis) min_dis=dis;
}
}
printf("%.4llf",min_dis);
return 0;
}
Process exited after 6.082 seconds with return value 0
请按任意键继续. . .