Rubina’s Race Against Time
Time: 2 s
Memory: 125 MB
Memory: 125 MB
Rubina is participating in a marathon of \(n\) meters. Initially, she runs the first \(m\) meters at a speed of \(u\) meters per second. After \(m\) meters, she becomes exhausted and runs the remaining distance at a slower speed of \({v}\) meters per second.
Calculate the total time (in seconds) it takes for Rubina to finish the marathon.
Calculate the total time (in seconds) it takes for Rubina to finish the marathon.
Input
The first line contains an integer \({n}\ ({1 \leq n \leq 10^9}) \) - the total marathon distance in meters, an integer \({m}\ ({1 \leq m < n}) \) - the distance before exhaustion in meters, an integer \({u}\ ({1 \leq u \leq 10^9}) \) - the initial speed in meters per second, and an integer \({v}\ ({1 \leq v <u}) \) - the speed after exhaustion in meters per second.
Output
A single line containing the total time taken to finish the marathon. Your answer is considered correct if its absolute or relative error does not exceed \({10 ^ {-6}}\).
Examples
| Input | Output |
|---|---|
|
100 40 5 3
|
28
|
| Input | Output |
|---|---|
|
393 175 25 13
|
23.76923077
|
| Input | Output |
|---|---|
|
1000 250 65 20
|
41.34615385
|
Notes
For C++, use this syntax \(cout << fixed << setprecision(X);\) Here, \(X\) is the desired number of decimal places.
Problem Info
| Problem ID | 374 |
| Time Limit | 2000 ms |
| Memory Limit | 128000 KB |
| Moderators | refred1 , lauhemahfus , meheraj_hossain_ , tafsiruzzaman , amirhozaifa , sagorahmedmunna , osama_bq , Rakib , Dr_KeK , fahimcp495 |
Statistics
Submit
You need to Login or Registration for submit your solution