编程介的小学生 2017-04-20 16:13 采纳率: 20.5%
浏览 672
已采纳

Gunman

Consider a 3D scene with OXYZ coordinate system. Axis OX points to the right, axis OY points up, and axis OZ points away from you. There is a number of rectangular windows on the scene. The plane of each window is parallel to OXY , its sides are parallel to OX and OY . All windows are situated at different depths on the scene (different coordinates z > 0).

A gunman with a rifle moves along OX axis (y = 0 and z = 0). He can shoot a bullet in a straight line.

His goal is to shoot a single bullet through all the windows. Just touching a window edge is enough.

Your task is to determine how to make such shot.

Input

There are several test cases in the input. The first line of each case contains a single integer number n (2 ≤ n ≤ 100) --- the number of windows on the scene. The following n lines describe the windows. Each line contains five integer numbers x 1i , y 1i , x 2i , y 2i , z i (0 < x 1i , y 1i , x 2i , y 2i , z i < 1000). Here (x 1i , y 1i , z i ) are coordinates of the bottom left corner of the window, and (x 2i , y 2i , z i ) are coordinates of the top right corner of the window (x 1i < x 2i , y 1i < y 2i ). Windows are ordered by z coordinate (z i > z i-1 for 2 ≤ i ≤ n).

Output

Output a single word "UNSOLVABLE" if the gunman cannot reach the goal of shooting a bullet through all the windows.

Otherwise, on the first line output a word "SOLUTION". On the next line output x coordinate of the point from which the gunman must fire a bullet. On the following n lines output x, y, z coordinates of the points where the bullet goes through the consecutive windows. All coordinates in the output file must be printed with six digits after decimal point.

Sample Input

3
1 3 5 5 3
1 2 5 7 5
5 2 7 6 6
3
2 1 5 4 1
3 5 6 8 2
4 3 8 6 4
Sample Output

SOLUTION
-1.000000
2.000000 3.000000 3.000000
4.000000 5.000000 5.000000
5.000000 6.000000 6.000000
UNSOLVABLE

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-04-21 13:53
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘