编程介的小学生 2018-12-17 16:18 采纳率: 20.5%
浏览 297
已采纳

数组的计算,和输出的结果,这个算法比较困难,用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条回答 默认 最新

  • threenewbee 2019-08-24 23:50
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误