编程介的小学生 2017-01-23 09:40 采纳率: 0.9%
浏览 925
已采纳

The Kylin Den

Description

As more and more people come to visit her in the den and got lost in it, Kylin Orange had started a rebuild project – turn all the walls into glass so that the dizzy visitors will clearly take in the spot they are heading to. And it was just finished. Contrary to her wish, however, things turns out to be more complex as the cheesy glass walls always reflect much of the light rather than let it all pass through. Thus the walls are actually transparent mirrors. As a result, when someone wants to locate a place in the den, he will see a bundle of it and gets lost even easier.

Anyway, to change it back can be another torturing labor which the exhausted Kylin does not want. She has to think about setting up some signposts. In the first place, she needs to know how many images (including the real one) of an object one can see from a particular place. There are two important rules of counting:

Any light that is reflected by the same wall twice will be ignored as it is getting too faint to recognize.
Light passes through exactly the fringes of some walls does not vanish.
Input

The input contains exactly one test case given as specified below:

Line 1 Four integers xm, ym, xd and yd, suggesting the locations of the observer (xm, ym) and the object (xd, yd). The two locations can coincide with each other.
Line 2 An integer N (0 < N < 9), the number of walls.
Line 3 – N + 2 Four integers x1, y1, x2 and y2 on each line, giving the two ends of a wall (x1, y1) and (x2, y2). The wall satisfies exactly one of four conditions:
x1 = x2
y1 = y2
x1 + y1 = x2 + y2
x1 − y1 = x2 − y2
The walls does not intersect or touch each other. All coordinates are in the range (−104, 104) × (−104, 104).

Output

Output the number of images that are seen.

Sample Input

0 0 0 0
2
-1 0 0 1
0 -1 1 0
Sample Output

5

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-01-31 14:21
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵