数组的计算,和输出的结果,这个算法比较困难,用C实现

Problem Description
There were two families in the village — family A and family B, while these two families didn’t get along well with each other. Now the head of the village decided to make a road through the village and it must be straight, for a straight line makes the way shortest and meanwhile, saves the cost. At that time, the heads of the two families proposed, because they didn’t want their own families live separated along the two sides of the road, thus it might decrease the solidarity of family. Besides, the two families were antipathetic to each other; neither wanted to live together with the other in a same side of the road. Then it made the village head in a pickle, he hoped the road to be as wide as possible. So what’s the possible maximal width of this road?
In order to simplify the problem, let’s regard the living place of each family member is just a point.

Input
There are several test cases in the input.

The first line of each input contains n and m (1 ≤ m,n ≤ 1000). As for the following n lines, there are two numbers in every line, representing the living places of A family members. And the following m lines represent the living places of B family members.

Output
The output numbers of each line are the maximal width of the road (retain four decimal), while if it’s impossible to make such a road, then just output 0.0000.

Sample Input
3 3
0.0 0.0
1.0 0.0
0.0 1.0
4.0 0.0
5.0 0.0
4.0 1.0

Sample Output
3.0000

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
算法的数据结构,C语言根据输入的半径值,计算球的体积。
1
算出给定数各个位上数字为偶数的和的算法问题,采用C语言编程的知识解答
0
数组的矩阵的转移的算法,怎么采用C语言的程序的计算的方式来实现的
0
从m张扑克牌中,选取n张牌,不区分花色,输出所有的组合,有什么比较高效的算法吗?
0
利用数组原理计算覆盖率的问题的算法,怎么使用C语言的程序的代码的编写的思路实现的?
3
合理使用算法运用C语言, 计算出给定数各个位上数字为偶数的和怎么做?
0
关于数组输入的平均数的计算的算法,要求采用C语言程序代码编写的过程来实现的做法?
0
如何综合运用C程序的编写的技术,在一行内输出n对应的月之数得算法
0
按照绝对值从大到小排序后输出,这个排序的算法用 C 语言的程序的设计的思想方式怎么实现的?
4
求解一维数组遍历算法
1
两端插入的数组的计算的实现问题,怎么采用C程序的语言的编程的方式去实现的算法计算
1
一个目标值与一个数组中的元素一个一个去比较,找出数组中与目标值最接近的一个元素,输出该元素下标
2
C语言,目标值与数组所有元素去比对,找出最接近的元素,输出下标
1
fibonacci算法使用数组实现
0
Cycling的计算的一个算法,用的C程序语言
2
悬赏Java语言怎么编写冒泡算法,对5个数字进行排序,而且数字是存放再数组里的
1
这个算法的问题在哪里?
1
如何确定神经网络中各特征对输出结果影响程度的大小
1
C#调用纯C的DLL时,结构体指针、数组、二维数组 怎么转换?
2
对数组最排序的实现算法