nyoj-97-Brothers Outing-September 18, 2013 09:10:36

Source: Internet
Author: User

Brother Outing Problem time limit: 3000 ms | Memory limit: 65535 KB Difficulty: 2 Describe the two brothers cycling outing, the younger brother first set out, every minute x meters, m minutes after the brother with a dog to start. To the speed of Y meters per minute chasing younger brother, and the dog at Z-meter per minute speed to the younger brother ran, after the younger brother and immediately returned, until brother catch up with his brother, the dog ran how many meters. Enter the first line to enter an integer N representing the number of groups of test data (n<100)
One row for each set of test data, four positive integers, respectively, for the M,X,Y,Z (data guarantee x<y<z) output the path of the dog run, the result is reserved two digits after the decimal point. Sample input

1
5 10 15 20
Sample output
200.00

 
# include<stdio.h>

int main ()
{
	int n,m,x,y,z;
	scanf ("%d", &n);
	while (n--)
	{
		scanf ("%d%d%d%d", &m,&x,&y,&z);
		printf ("%.2lf\n", m*x*z*1.0/(Y-x));
	}

	return 0;
}        


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.