编程介的小学生 2017-01-23 09:40 采纳率: 20.3%
浏览 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 在误装Windows server2019 后如何利用Windows.old恢复?
  • ¥20 代码实现状态连接包过滤防火墙的设计与实现
  • ¥15 vscode的红色箭头爆红和has no default export报错
  • ¥15 关于#sql#的问题:#情况描述 在用vs对项目进行调试时,出现找不到网络路径,然后查看SQL配置工具,发现SQL服务显示远程调用过程失败(相关搜索:防火墙)
  • ¥15 eNSP中基于默认路由及浮动路由的公司与分部互联和校园网综合项目
  • ¥15 主要进行描述泥浆在管路不同区段泥浆的密度不相同,泥浆的密度有高有低,此时管路的摩阻分布需要怎么计算,(标签-matlab)
  • ¥40 通过编制程序计算圆管内层流充分发展对流换热,参数如图5-4,以及公式5-16所示,要求用表5-6对程序计算准确性进行验证
  • ¥20 该学习哪个编程语言? AI会取代程序员吗?
  • ¥15 ensp如何拼通IP地址
  • ¥15 saber软件导入Ibis模型报错