1410. Mirror trap

单点时限: 2.0 sec

内存限制: 256 MB

A mirror trap is a cuboid made of mirrors, the reflecting sides of which are facing the interior of the cuboid. Precisely in the geometric centre of the cuboid there is a miniature laser (whose dimensions we shall neglect). The task is to aim the laser in such a way that the beam travels the longest total distance possible and returns to the laser itself. By total distance we shall denote the sum of distances traveled by the laser beam in each of the three directions parallel to the edges of the mirrors (i.e. we are using the so called Manhattan (city) metric).

The dimensions of the trap are even integers. The edges and vertices of the trap, where distinct sides meet, do not reflect the laser beam. Inside the cuboid we shall introduce a cartesian coordinate system. Its axes are parallel to the edges of the trap and the laser shall be placed in the origin. The laser may be aimed at any integer point (a point whose all coordinates are integers) within the trap, the points on the surface of the mirrors included (with the single exception of the laser itself, i.e. the point (0, 0, 0)).

Task

Write a programme which:

reads from the standard input the dimensions of the mirror trap,

calculates such a point, that a laser beam fired from the laser it the direction of this point:

shall be reflected from the mirrors (but not necessarly from all of them),

shall neither intersect an edge nor a vertex of the mirror trap,

shall return to the laser, possibly from a different direction,

shall travel the longest total distance possible (in the sense of the definition provided).

writes the outcome to the standard output.

输入格式

A single test consists of many mirror traps to be analysed. The first line of the standard input contains a single integer 1 <= K <= 1000, denoting the number of traps to be analysed. In the lines 2 … K + 1 there are descriptions of the traps, a single per line. The description of the trap consists of three numbers 5 <= x, y, z <= 1000, separated by single spaces. The mirror trap has the dimensions of 2x2y2z.

输出格式

Your programme should write exactly K lines to the standard output. The i-th line should contain a solution for the i-th trap: three integers kx, ky, kz, separated by single spaces, - x <= kx <= x, - y <= ky <= y, - z <= kz <= z, (kx, ky, kz) <> (0, 0, 0). Those numbers signify that in the i-th trap the laser should be aimed at the point, whose coordinates are (kx, ky, kz).

Should there be a greater number of correct solutions, your programme ought to write out any one of them.

样例

Input
2
5 6 7
5 6 6
Output
4 5 6
4 6 5

0 人解决,0 人已尝试。

0 份提交通过,共有 0 份提交。

9.9 EMB 奖励。

创建: 16 年,8 月前.

修改: 6 年,7 月前.

最后提交: N/A.

来源: POI

题目标签