编程介的小学生 2017-12-03 05:25 采纳率: 20.5%
浏览 945
已采纳

Detector Placement

Problem Description
Dr. Gale is testing his laser system. He uses a detector to collect the signals from a fixed laser generator. He also puts a special prism in the system so that he can filter the noise. But he is not sure where to put the detector to collect the signals. Can you help him with this problem?

Here n1 and n2 are the refractive indices of the two media. In order to simplify the problem, here we assume the prism is a triangle. The laser generator will not be placed on the surface of the prism or inside the prism. The laser goes in one direction and the detector can receive signals from any direction. The detector is place on the ground where th y-coordinate is zero. There is no energy lost in the refraction. That is to say, there is no reflection in the signal transmission. You can assume that there is no total reflection or the situation that the laser passes the vertex of the prism. Given the position and the direction of the laser generator and the prism, you are asked to find the position of detector so that it can receive the signals from the laser generator.

Input
The input contains multiple test cases. The first line is the total number of cases T (T ≤ 100). The first line of each test case contains 2 integers, indicating the x and y coordinates of the laser generator respectively.The second line contains 2 integers describing a point the laser will go through when the prism is not placed. The third line contains 6 integers describing the three vertices of the prism. The fourth line contains a real number u, the refractive index of the prism (1 < u ≤ 10). We assume the refractive index of the air is always 1.0. The absolute value of the coordinates will not exceed 1000. The y coordinates are all nonnegative. The prism and the laser generator are strictly above the ground.

Output
If there is no place in the ground that can receive the signals output "Error". Otherwise, output the x coordinate of the place. Your answer should be rounded to the 3rd digit after the decimal point.

Sample Input
2
0 10
0 0
-1 3 1 2 -1 1
1.325
0 10
0 20
-1 3 1 2 -1 1
1.325

Sample Output
-0.658
Error

  • 写回答

1条回答 默认 最新

  • oyljerry 2017-12-03 06:10
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛