Welcome to ZOJ
Select Problem
ZOJ Problem Set - 3451
Doraemon's Shooting Practice

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Doraemon becomes interested in soccer after watching 2010 World Cup, and he is practicing shooting on the playground now. Your work is to judge whether he will shoot the ball in the goal.

Assume the world is in three-dimensional coordinate system. The football pitch is on xy-plane with coordinate (0, 0, 0), (68, 0, 0), (0, 105, 0) and (68, 105, 0). The goal is on yz-plane at the center of the pitch. The goal is a rectangle with the height 2.44 and width 7.32. Doraemon is on the playground at position (x0, y0, 0), he shots the football at initial speed v0, and the direction vector of the ball is (dx, dy, dz), not necessarily unit vector. If the ball has vertical motion, then after each bounce the football's speed will be half of the previous, and the direction after bounce meets the law of reflection. Ignore the ball's rotation and the friction from the ground.


Input contains multiple cases. Process to the end of file. At the first line of each case, it will contain 2 floating numbers indicating x0 (0 ≤ x0 ≤ 68), y0 (0 < y0 ≤ 105) separated by a single space, the next line contains a single integer n (1 ≤ n ≤ 100), which is the times Doraemon tries to shot. In the following n lines, each line contains 4 floating numbers indicating v0 (0 < v0 ≤ 60), dx (-100 ≤ dx ≤ 100), dy (-100 ≤ dy ≤ 100), dy (0 ≤ dz ≤ 100). We ensure the ball would not hit the edge of the goal.


For each case, you need to print "Case #case_number:" first. In the following n lines, each line should print "Shot shot_number: " first, then print the result, "yes" or "no", indicating whether the ball will in the goal or not. Ball in the goal means when the ball reaches xy-plane, the coordinate of the ball is strictly in the area of the goal. There are no such cases that the ball is just in the goal or just not in the goal.

Sample Input

34 20
10 1 -1 0
10 0 -1 0

Sample Output

Case #1:
Shot 1: no
Shot 2: yes


  • Acceleration of gravity g = 9.80665 m/s2
  • The unit of all the variables above is SI(international system of units)

Author: QU, Zhe
Contest: ZOJ Monthly, December 2010
Submit    Status