#P1016. Problem 3. Activating Robots
Problem 3. Activating Robots
当前没有测试数据。
一、Problem Name
Activating Robots
二、Problem Description
You and a single robot are initially at point on a circle with perimeter (). You can move either counterclockwise or clockwise along the circle at unit per second. All movement in this problem is continuous.
Your goal is to place exactly robots such that at the end, every two consecutive robots are spaced away from each other (, divides ). There are () activation points, the th of which is located distance counterclockwise from (). If you are currently at an activation point, you can instantaneously place a robot at that point. All robots (including the original) move counterclockwise at a rate of unit per seconds ().
Compute the minimum time required to achieve the goal.
三、Input Format (input arrives from the terminal / stdin)
- The first line contains , , , and .
- The next line contains space-separated integers .
四、Output Format (print output to the terminal / stdout)
The minimum time required to achieve the goal.
五、Sample Input and Output
Sample Input 1
10 2 1 2
6
Sample Output 1
22
Explanation: We can reach the activation point at in seconds by going clockwise. At this time, the initial robot will be located at . Wait an additional seconds until the initial robot is located at . Now we can place a robot to immediately win.
Sample Input 2
10 2 1 2
7
Sample Output 2
4
Explanation: We can reach the activation point at in seconds by going clockwise. At this time, the initial robot will be located at . Wait an additional second until the initial robot is located at . Now we can place a robot to immediately win.
Sample Input 3
32 4 5 2
0 23 12 5 11
Sample Output 3
48
Sample Input 4
24 3 1 2
16
Sample Output 4
48
六、Scoring Rules
- Inputs 5 - 6: .
- Inputs 7 - 12: , .
- Inputs 13 - 20: .
- Inputs 21 - 24: No additional constraints.
Problem credits: Benjamin Qi.