DWITE Online Computer Programming Contest
January 2008
Problem 1
Four player Pong with no players

This "game" has been simplified so much that all the players left. Incidentally, with no paddles left on the screen, it makes it even more simple, as there is nothing to bounce off. The only objective left now is to figure out where the ball will hit the edge of the playfield.

The playfield is a rectangle of the size 100 wide by 50 high. Lower left corner is at (0,0); upper right is at (100,50). The ball is the size of a single pixel, and the score counts as that pixel lands on the edge. The ball starts out at the center, at (50,25), and it's velocity will be provided in the input file.

The input file DATA1.txt will contain 5 sets of input, 2 lines each. The first line will be an integer value -10 <= H <= 10, the horizontal component of the velocity. The second line will be an integer value -10 <= V <= 10, the vertical component of the velocity. There will be no 0,0 input, and thus there will always be a solution.

The output file OUT1.txt will contain 5 lines, the location where the ball hits the edge, in the x,y format.

Note: if one was to simulate the game using a loop, the integer values in all of the cases will land exactly on an edge during one of the steps.

Another note: Some might want to draw to screen while developing or debugging their code -- this could be helpful to get a better idea of what's going on, but please remember to comment out any graphical code before submitting a solution.

Sample Input (3 of 5 shown):
5
0
0
-5
5
5
		        
Sample Output (3 of 5 shown):
100,25
50,0
75,50