| UDESC Selection Contest 2023-2 |
|---|
| Finished |
You are working on DJ software and need to simulate a virtual turntable. A vinyl disc is displayed on the screen, and the user can use mouse movements to make the disc move forward or backward. The simulated vinyl disc spins at $$$33+\frac{1}{3}$$$ RPM (rotations per minute) in a clockwise direction. The user can perform a drag-and-drop motion from any position on the disc to any other position. For instance, if the user initiates a movement from the bottom of the disc and goes upwards and to the right, the disc should rewind:
We aim to approximate the real world by considering only the angle formed by the two positions relative to the center of the disc. Note that there are two angles for any two starting and ending positions, and the program should use the smaller angle to determine how much the disc has rotated. If the user attempts a movement that starts or ends outside the disc, the disc will not be moved.
Mouse positions are given in the first quadrant of the Cartesian plane (meaning the position $$$(0, 0)$$$ is at the lower-left corner), and the disc is scaled on the screen from position $$$(0, 0)$$$ to position $$$(D, D)$$$. So, given the disc's size on the screen and the initial and final mouse positions during a drag-and-drop operation, determine how many seconds of music should be fast-forwarded or rewound.
The first line of input contains an integer $$$D$$$ $$$(1 \le D \le 10^4)$$$, the diameter of the vinyl disc on the screen. The second line provides the coordinates when the mouse button was pressed, the integers $$$I_X$$$ and $$$I_Y$$$ $$$(0 \le I_X, I_Y \le D)$$$. Finally, the coordinates when the mouse button was released are given on the third line, the integers $$$F_X$$$ and $$$F_Y$$$ $$$(0 \le F_X, F_Y \le D)$$$.
It is guaranteed that the mouse movement never passes through the center of the disc and that the angle formed between the two positions is greater than 0.
Print on a single line the number of seconds the music should move forward (positive) or backward (negative) using the drag-and-drop mouse operation. Your answer will be accepted if it has an absolute or relative error $$$\leq 10^{-4}$$$
100 55 20 80 50
-0.402688
36 18 0 0 18
0.45
100 0 0 1 0
0
100 30 25 10 65
0.359481
| Name |
|---|


