OpenJudge

11:Clever Frank

总时间限制:
1000ms
内存限制:
65536kB
描述

To thank his laborer Frank for taking care of himself for years, the old farmer Bob promised that Frank could ride a horse to enclose his own farm in an hour, and the land in the enclosure would belong to Frank. But it troubles Frank that there was a stable in Bob's farm, and the land occupied by the stable could not be used to cultivate, and there was no way to ride through the stables, and even if he had completely enclosed the stable, Bob will not attribute the stable to Frank.

In order to get more land, Frank has simplified and abstracted the problem:

1. The farm is a n * m square matrix

2. The route of riding is a closed line along the edge of the box

3. The stable is a rectangle in the matrix. Because there is only one hour, so the riding circumference does not exceed L.

Frank would like to know the maximum area of land he can enclose (the stable area is not counted).

as the figure shows:

Figure 1 is a valid route;

Figure 2 is also a valid route, but the area of land is 0;

Figure 3 is not a valid route, because it is not closed;

Figure 4 is not a valid route, because through the stables.



输入
The first line is an integer N which means the number of test cases. For each case, there are two lines.
(i) the first line is three integers: n, m, L (1 <= n, m <= 100, 1 <= L <= 400)
(ii) the second line is four integers: l, r, b, t ( 0 <= l < r <= m,
0 <= b < t <= n ) that represents the left, right, the lower, the upper boundary coordinate of the stable
输出
For each case, output the maximum area of land that Frank can enclose.
样例输入
2
4 4 8
1 3 1 3
7 2 5
0 1 5 7
样例输出
3
1

01 Use "long long" to calculate the answer
05 Expected Value of an Expression: Ai is less than 2^20

全局题号
15304
提交次数
5
尝试人数
1
通过人数
0