|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||4||1||1||25.000%|
There are many scenarios in which we need to know how fast an object is moving. For example, the air-traffic controller in an airport would like to know the speed of a descending plane and give warning if it's too fast or too slow. The speed detection cameras have helped the police to catch the speeding drivers, and so on.
In this problem, you are supposed to write a program to recognize the speed of a moving object.
Assume that an object is moving on a two dimensional plane, with a constant speed and direction. A camera is taking a shot every second. Assume the camera can record the real situation of the plain - you don't need to worry about the view-angle.
The background is black and the only object is white, except some noise introduced by the camera. Anyway, you can assume that the largest continuous white area is always the object. There is always only one largest continuous white area in this problem.
Given several pictures taken by the camera, calculate the speed of the object. Output the speed of the object.
A picture is represented by a matrix which contains "." or "x" only, where"." in the matrix means a black block and "x" means a white block. There are at least two pictures.
Here are some detailed definitions:
Note that you may get different shape of an object in different pictures.
The input is a file containing several data cases. Each case begins with a line, with only two numbers: m and k. Then follows by several m*k (m columns, k rows) matrices. Each matrix represents one picture taken by the camera. There are at least two pictures. There is always a separator line between each matrix inside a data set. The separator line is a line with m "-"s. The last matrix of a data set is followed by a terminating line - a line with m "="s.
A line with two zeros presents the end of the input file.
The picture size is at most 256*256. There are at most 256 pictures in one test case.
For each test case, output a line with two numbers which represent the speed of the object in X and Y direction respectively. The accuracy is up to 2 digits after decimal point. The speeds of the objects are in mm/s.
10 5 .........x .....xxx.x ....xxx... .....xxx.. x......... ---------- .........x .........x ...xxx.... ..xxx..... x..xxx.... ========== 0 0