5479: C-Fall with Trees

内存限制:512 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:1 解决:1

题目描述

Fall wants to draw a perfect binary tree.

We first stipulate that all nodes in the tree with the same depth also have the same y-coordinate in the plane. Define nodes with the same depth to be nodes at the same level, then the perfect binary tree has four properties.

- It is a full binary tree.
- The difference between the y-coordinates of two nodes at each adjacent level is a constant.
- The difference between the x-coordinates of two adjacent nodes at the same level is constant.
- The x-coordinate of each node is the average of the x-coordinates of its sons.

Fall has drawn the root node and its left and right sons of this binary tree. Now Fall intends to draw a total of k levels and cut the binary tree down and paste it on the wall afterwards, so he wants to know what is the area of the convex hull of all nodes of this perfect binary tree.

输入

The input consists of multiple test cases.

The first line contains an integer T (T2×105) -- the number of test cases.

For each test case:

In the first line, there is an integer k (2k104).

In the second line, there are six integers xroot,yroot,xlson,ylson,xrson,yrson[104,104] ,which represent the coordinates of the root node and its sons.

It is guaranteed that all the coordinates meet the conditions of the question, which means:
- xlson+xrson=2×xroot
- ylson=yrson
- yroot>ylson,xlson<xrson

输出

For each test case, output a real number representing the answer, with three decimal places.

样例输入 复制

3
3
0 0 -2 -2 2 -2
4
0 0 -4 -2 4 -2
10000
0 0 -10000 -10000 10000 -10000

样例输出 复制

14.000
54.000
3999000000000.000