P16197 [ROIR 2014 Day 2] Lights Traffic Lights.
Description
At the computer summer camp site, an electric scooter route has been set up. Since the scooter can go directly to the ICT center, the student Pakhom decided to try this route. Along the route, the scooter passes through two traffic lights in order at a constant speed, and it passes both when they are green. It is known that the two traffic lights are $x$ meters apart, and their signal changes are perfectly synchronized: green stays on for $a$ minutes, then red stays on for $b$ minutes, then it switches back to green, repeating in a cycle. There is no yellow light between red and green. The scooter’s speed will not exceed $1000$ meters per minute. The scooter is allowed to pass through the intersection at the exact moment when the light switches.
After arriving at the ICT center, Pakhom became curious about what the maximum constant speed between the two traffic lights could be.
Write a program to compute this maximum speed for Pakhom.
Input Format
The first line of the input contains three integers $a$, $b$, and $x$, satisfying $1 \le a \le 100$, $1 \le b \le 100$, and $1 \le x \le 100\,000$.
Output Format
The output should contain only one number: the maximum speed the scooter can achieve between the two traffic lights. The absolute or relative error of the answer must not exceed $10^{-9}$.
Explanation/Hint
### Scoring
For the testdata worth $50$ points, the answer is an integer.
Translation source: GPT 4.1 mini.
Translated by ChatGPT 5