Elder brother outing Problems

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.