当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
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:
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:
|
The walls does not intersect or touch each other. All coordinates are in the range (−104, 104) × (−104, 104).
Output the number of images that are seen.
0 0 0 0 2 -1 0 0 1 0 -1 1 0
5
时间上限 | 内存上限 |
2000 | 131072 |