Hdou/hdu 25,482 Military confrontation (see your thinking ~)

Source: Internet
Author: User

Problem Description
The Liao Army and the MCA for many years, and finally in a autumn morning broke out a large-scale conflict. This is the case, the morning, by the law-pacision leader of the Liao Army suddenly led tens of thousands of troops to the MCA Mountain, And this time stationed in the MCA defensive front of the veteran Guigo. Guigo learned this news, immediately summoned the elite, to stop the Liao Army. Now known the Liao Army forward speed U m/s, Ji Brother speed V m/s, the two armies began a distance of L meters, war reporters from the two armies began to March immediately began with W m/ The speed of the second nonstop to and fro between the two armies to make the first report, that is, one to the party, immediately return to the other side. When the two armies clashed, the battlefield reporters traveled altogether.

Input
First enter a T, which indicates that there is a T group of data, followed by the T line:
Each line has four real numbers u, V, W, l, respectively, representing the Liao Army speed, Ji-brother speed, reporter speed, and the starting distance.

Output
The output line of real numbers represents the total distance. Accurate to 3 digits after the decimal point.

Sample Input
1
10 20 30 100

Sample Output
100.000

This topic is very simple ~ ~ Ignore the reporter ran to run the process ~ we can first calculate how long the 2 troops meet ~
Then according to the speed of the reporter * Time ~ is the total distance of reporters to run ~

ImportJava.io.InputStreamReader;ImportJava.util.Scanner;/** * * @author Chen Haoxiang * * 2016-5-16 * * Public  class Main{     Public Static void Main(string[] args) {Scanner SC =NewScanner (system.in);intT =sc.nextint (); while(t-->0){DoubleU =sc.nextdouble ();Doublev =sc.nextdouble ();DoubleW =sc.nextdouble ();DoubleL =sc.nextdouble ();DoubleTime = l/(U+V); System.out.printf ("%.3f", time*w);        System.out.println (); }    }}

Hdou/hdu 25,482 Military confrontation (see your thinking ~)

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.