Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Laser-Ball
Description Mr. X and his friends are great funs of Laser-Ball Game. Basically, the main idea of the game is very simple. Each player of the game has a laser gun and it is necessary to hit an opponent with a laser beam. To make the game more interesting, Mr. X with friends created their own Laser-Ball playground. They rented an empty rectangular hall and set up a number of big mirrors. What makes the game more interesting is the additional ability to shoot into a mirror since that a reflected laser beam also can hit an opponent. You need to write a program which determines if it is possible to hit an opponent standing in a point B from point A. If such a hit is possible the program needs to give a direction. To clarify the problem the following rules are given.
Input The input contains one data set. A data set starts with a line containing two real numbers XB and YB separated by one or more spaces. The next line contains two integer numbers, N and K, separated by one or more spaces. The next N lines contain four real numbers X1i, Y1i, X2i, Y2i each, separated by one or more spaces. Output The output contains the word “impossible”, if the shoot is impossible. Otherwise it contains two real numbers a, b, (separated by one space), which give a direction of the shoot. Sample Input sample input #1 4.0 0.0 2 1 2 -1 2 1 1 2 3 2 sample input #2 4 0 1 1 1 0 3 0 sample input #3 4 0 1 1 2 -1 2 1 Sample Output sample output #1 1 1 sample output #2 1 0 sample output #3 impossible Source Northeastern Europe 2004, Western Subregion |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator