80分求助
查看原帖
80分求助
406170
Jason_yinkai楼主2021/8/10 14:55

这是测试点

#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
struct str{
	int x,y;
}map[1005];
int n;
double num = 1e8;
int main(){
	cin>>n;
	for(int i = 1;i <= n;i++){
		cin>>map[i].x>>map[i].y;
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			if(i != j){
				int x = map[i].x - map[j].x;
				int y = map[i].y - map[j].y;
				double z = sqrt(x * x + y * y);
				num = min(num,z);
			}
		}
	}
	printf("%.4f",num);
}
2021/8/10 14:55
加载中...