Frommyvalleyuphard @ 2023-07-20 17:22:06
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
struct sbsbsb{
long long sbsbsbsb,sbsbsbsbsb;
};
bool sbsb(sbsbsb sb222,sbsbsb sb333){
return sb222.sbsbsbsb<sb333.sbsbsbsb;
}
using namespace std;
int main(){
int a;
cin>>a;
double sb=pow(10,18);
int b[a][2]={};
sbsbsb c[a];
for(int e=0;e<a;e++){
cin>>b[e][0]>>b[e][1];
c[e].sbsbsbsb=b[e][0]+b[e][1];
c[e].sbsbsbsbsb=e;
}
sort(c,c+a,sbsb);
for(int f=0;f<a;f++){
for(int g=f+1;g<a;g++){
if(pow(double(c[f].sbsbsbsb)/2-double(c[g].sbsbsbsb)/2,2)*2>=sb){
break;
}
sb=min(sb,abs(pow(b[c[f].sbsbsbsbsb][0]-b[c[g].sbsbsbsbsb][0],2)+pow(b[c[f].sbsbsbsbsb][1]-b[c[g].sbsbsbsbsb][1],2)));
}
}
cout<<fixed<<setprecision(4)<<pow(sb,0.5);
}
复杂度:O(n~n*(n+1)/2)
by shengheng @ 2023-07-25 11:11:15
@_GGG 骂谁呢
by Frommyvalleyuphard @ 2023-07-25 12:20:49
骂我写的代码太破