编程介的小学生 2018-12-23 21:17 采纳率: 20.5%
浏览 881
已采纳

二维平面上计算点的距离的问题,点的范围在-100~100,C语言计算,谢谢

Problem Description
There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his people. Now he is just like a boy in love and can’t refuse any request from the devil. Also, this devil is looking like a very cute Loli.

Y*wan find that the only way to save this country is to kill every loli. Y*wan is fine about that because he doesn't like loli. But the princess's knight's member just thinks he is insane. So they compete in an algorithm contest.

In this contest, Y*wan suck at this problem, if y*wan can't win, the mankind will become extinct, so it's your turn to help y*wan solve this problem.

There are n points in the plane, you pick a random point in [0,X] x [0,Y], after that you output the second nearest squared distance from this point to those n points. What is the expectation of your output?

Input
The first line contains an integer T, denoting the number of the test cases.
For each test case, the first line contains 3 integers n,X,Y.
The next n lines, each contains 2 integers x, y, denote that there is a point x,y.

T<=5,2<=n<=100.
0<=X,Y<=100 , -200<=x,y<=200

Output
For each test case, output the answer in one line.
This problem is special judged. The relative error less than 1e-6 will be accepted.

Sample Input
1
2 10 10
0 0
10 10

Sample Output
100.0000000000

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题