Elder brother outing Problems
Description
When the two men go on a cycling outing, their younger brother leaves first, X meters per minute, and m minutes later, his brother takes a dog and leaves. He chased his younger brother at the speed of Y meters per minute, while the dog ran to his younger brother at the speed of Z meters per minute. After catching up with his younger brother, he immediately returned, how many meters does a dog run?
-
Input
-
Enter an integer N in the first line, which indicates the number of groups of test data (n <100). Each group of test data occupies one row, which are four positive integers, namely, M, x, y, Z (Data guarantee x <Y <z)
-
Output
-
Output the path where the dog runs. The result is retained to the second decimal point.
-
Sample Input
-
15 10 15 20
-
Sample output
-
200.00
#include<iostream>#include<iomanip>using namespace std;int main(){int n;int a,b,c,d;double sum;cin>>n;while(n--){ sum =0; cin>>a>>b>>c>>d; sum = (a*b*d)/(c-b+0.00); cout<<fixed<<setprecision(2)<<sum<<endl;}return 0;}
Elder brother outing Problems