编程介的小学生 2017-08-07 09:43 采纳率: 20.5%
浏览 787
已采纳

Frame Polygonal Line

You are going to read a sequence of pairs of integer numbers. Each pair represents the Cartesian coordinates of a point in a 2-dimentional plane. The first number is the x coordinate, while the second is that of y. The sequence represents a polygonal line. Your task is to draw a rectangle with minimal length of sides that exactly surrounds the polygonal line. The sides of the rectangle are parallel to x- and y-axis, respectively.

Input

Input consists of several test cases. For each case, a sequence of coordinates is given. Each pair of x and y occupies a line, with |x| and |y| less than 2^31. The sequence is terminated with a pair of 0's. Note that (0, 0) will never be considered as a point on any of the polygonal lines. An empty polygonal line signals the end of input.

Output

For each test case, print in one line two pairs of numbers, which are the south-west and north-east corners of the surrounding rectangle. The numbers must be separated by one space as is indicated in the samples.

Sample Input

12 56
23 56
13 10
0 0
12 34
0 0
0 0

Sample Output

12 10 23 56
12 34 12 34

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试