While making a vaccine for COVID-19, the scientists generated a new virus by mistake and it is more dangerous than the coronavirus. So they planned to kill the virus in the lab where they generated the virus by mistake to avoid it's spread. The only way to kill the virus is by the electric rod of very high voltage. Since very high voltage is passing through the electric rod, it cuts off some amount of voltage after every
X minutes to avoid any type of accident. So the scientists again maximize the voltage intensity of the electric rod after every Y minute. The electric rod gets very high voltage and low voltage instantly.It is known that to kill the virus, scientists havetogive K minutes of very high voltage or 2∗K
minutes of low voltage. They want to find how much time they have to give the electric shock to kill the virus by assuming that virus is getting the very high voltage and low voltage evenly.
input format
The single line contains three space-separated integers X,Y,K.
Output format
Print a single number, the total time to kill the virus in minutes. Print 8 digits after the decimal.
Constraints
1<=X,Y,K<=10 raised to 10
Input
4 2 7
Output
7.00000000
Sample test case explanation
X=4and Y=2, so in every2 minute scientists check whether the voltage is low or high. If it is low then they maximize the voltage.
So for the first7 minutes voltage is never low and hence the virus will be killed
What I have tried:
<pre lang="c++">
#include <bits/stdc++.h>
#include<iomanip>
using namespace std;
int main()
{
long int X,Y,K;
cin>>X>>Y>>K;
if(X>Y)
cout<<setprecision(8)<<K;
else
cout<<setprecision(8)<<2*K;
return 0;
}