307466: CF1360A. Minimal Square

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

Description

Minimal Square

题意翻译

## 题意 有两个完全一致且**不重合**的矩形,长为 $a$,宽为 $b$。二矩形都在一个大正方形型内。矩形可以任意旋转,但是要求**所有矩形的边和正方形的边满足其中任意二条边都互相平行或垂直**。 当然有很多情况满足上述条件。您需要给出正方形**最小**可能的**面积**。 ## 输入格式 **本题含有多组测试数据**。 第一行一个整数 $t$,为数据组数。 对于每一组数据一行二整数 $a$ 和 $b$,表示矩形的边长。 ## 输出格式 对于每一组数据一行一个数,表示可能的最小正方形面积。 ## 数据范围 $1 \leq t \leq 10^4$ $1 \leq a,b \leq 100$

题目描述

Find the minimum area of a square land on which you can place two identical rectangular $ a \times b $ houses. The sides of the houses should be parallel to the sides of the desired square land. Formally, - You are given two identical rectangles with side lengths $ a $ and $ b $ ( $ 1 \le a, b \le 100 $ ) — positive integers (you are given just the sizes, but not their positions). - Find the square of the minimum area that contains both given rectangles. Rectangles can be rotated (both or just one), moved, but the sides of the rectangles should be parallel to the sides of the desired square. Two rectangles can touch each other (side or corner), but cannot intersect. Rectangles can also touch the sides of the square but must be completely inside it. You can rotate the rectangles. Take a look at the examples for a better understanding. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1360A/e330934c7a121fc239f3601895974cbcd8e15302.png)The picture shows a square that contains red and green rectangles.

输入输出格式

输入格式


The first line contains an integer $ t $ ( $ 1 \le t \le 10\,000 $ ) —the number of test cases in the input. Then $ t $ test cases follow. Each test case is a line containing two integers $ a $ , $ b $ ( $ 1 \le a, b \le 100 $ ) — side lengths of the rectangles.

输出格式


Print $ t $ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $ a \times b $ .

输入输出样例

输入样例 #1

8
3 2
4 2
1 1
3 1
4 7
1 3
7 4
100 100

输出样例 #1

16
16
4
9
64
9
64
40000

说明

Below are the answers for the first two test cases: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1360A/e330934c7a121fc239f3601895974cbcd8e15302.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1360A/d9c5c718aa52d64cec56fdc2c292de1d46c2e21b.png)

Input

题意翻译

## 题意 有两个完全一致且**不重合**的矩形,长为 $a$,宽为 $b$。二矩形都在一个大正方形型内。矩形可以任意旋转,但是要求**所有矩形的边和正方形的边满足其中任意二条边都互相平行或垂直**。 当然有很多情况满足上述条件。您需要给出正方形**最小**可能的**面积**。 ## 输入格式 **本题含有多组测试数据**。 第一行一个整数 $t$,为数据组数。 对于每一组数据一行二整数 $a$ 和 $b$,表示矩形的边长。 ## 输出格式 对于每一组数据一行一个数,表示可能的最小正方形面积。 ## 数据范围 $1 \leq t \leq 10^4$ $1 \leq a,b \leq 100$

加入题单

算法标签: