#K42172. Fencing and Water Tap Installation

    ID: 27029 Type: Default 1000ms 256MiB

Fencing and Water Tap Installation

Fencing and Water Tap Installation

A farmer owns a rectangular field with specified dimensions L and W. The farmer needs to fence the entire perimeter of the field and install a water tap exactly at the center. Your task is to compute the total length of fencing required and the exact coordinates of the midpoint where the water tap should be installed.

The fencing length is given by the formula: \( P = 2\times(L + W) \), and the midpoint coordinates are \( \left(\frac{L}{2}, \frac{W}{2}\right) \).

Input will be provided for multiple test cases. For each test case, calculate and output the required perimeter and the midpoint coordinates.

inputFormat

The first line contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains two integers \(L\) and \(W\), denoting the length and width of the field respectively.

Input Format:

T
L1 W1
L2 W2
... 
LT WT

outputFormat

For each test case, output a single line containing three values separated by spaces:

  1. The total fencing length \(P\) (an integer).
  2. The \(x\)-coordinate of the midpoint (a floating-point number).
  3. The \(y\)-coordinate of the midpoint (a floating-point number).

Output Format:

P x y
## sample
1
8 5
26 4 2.5

</p>