407047: GYM102697 018 Machines

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

018. Machinestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

In mechanical engineering, the primary tool used to measure the energy amplified into a simple machine or a compound machine is called a concept known as the Mechanical Advantage, which signifies the ratio of the energy put into a machine, and the amount of force it outputs.

In one type of simple machine, the lever, mechanical advantage will be calculated by the lengths of the two sides, with the position of the fulcrum determining the length of the two sides. A diagram and a simplified formula of this process has been given below:

where A is the length of the side where Force 1 is being applied, and B is its respective counterpart.Input

Your objective is to find the mechanical advantage of a lever, given side A and side B. The first positive integer n is the amount of inputs that will follow.

ExampleInput
4
10 5
2 3
7 5
18 7
Output
2.0
0.6666666666666666
1.4
2.5714285714285716

加入题单

上一题 下一题 算法标签: