Problem Set
Online Contests
Major Exercises
OI Special
Online Status
User Ranklist
Register new
Web Links
Hunan Normal University
College of Information Science and Engineering
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB
Total submit users: 37, Accepted users: 27
Problem 10869 : No special judgement
Problem description
  Today, here's a interesting problem.

Nowadays , optical fiber(光纤) is widely used in our life. Fiber Transmission (光纤传输) is the method to send  optical information (光信息)in a special pipe, as the figure shows.

The light goes into the pipe at the left end of the pipe, then after some times direct reflection, goes out the pipe at the right end , to send optical message.

Here's the problem, when the light goes into the pipe in a given direction ,which direction will it be when it goes out the pipe.

  The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. (T <= 100)

Each test case start with two positive integers D , L , which indicate the diameter of pile and the length of the pipe.(that is to say the pipe is between Y = D , Y = 0,X = 0,and X = L).next lines follow three integers, h, Vx, Vy. represents the position and direction in which the light goes into the pipe, the position is (0,h) and the direction is vector (Vx, Vy). All numbers in the input is in the range of  int32.(D>= h>= 0,D > 0,L > 0,Vx > 0,Vy != 0.we ensure that the light can goes into the pipe in the given direction and position.)

  Output two integers Vx2 , Vy2 represent the direction vector in which the light goes out the pipe. because of the various way to present that direction, we need you make Abs(Vx) == Abs(Vx2).

Sample Input
2 10
2 1 -1
2 11
2 1 -1
2 10
1 1 -1
Sample Output
1 -1
1 1
1 1
Problem Source

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:9449 today,15449738 total, since 2010-05-07