题解 CF1360A 【Minimal Square】
这题没什么好讲的吧= =
大概就是只有 \(2\) 种不同的放置方法:
一种是 \(a\) 和 \(2 * b\) 放一边
另一种是 \(2 * a\) 和 \(b\) 放一边
输出 \(min(max(a * 2, b), max(a, b * 2)) * min(max(a * 2, b), max(a, b * 2))\) 即可
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#define N 1010
#define M 5000010
#define ls x << 1
#define rs x << 1 | 1
#define inf 0x3f3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define mid ((l + r) >> 1)
#define int long long
//#define ll long long
#define XRZ 10000000000000
#define pai acos(-1)
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
using namespace std;
inline int read() {
register int x = 0, f = 1; register char c = getchar();
while(c < '0' || c > '9') {if(c == '-') f = -1;c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
return x * f;
}
int dx[10] = {0, 1, 1, 2, 2, -1, -1, -2, -2};
int dy[10] = {0, 2, -2, 1, -1, 2, -2, 1, -1};
signed main() { int T = read();
while(T --) { int a = read(), b = read();
printf("%d\n", min(max(a * 2, b), max(a, b * 2)) * min(max(a * 2, b), max(a, b * 2)));
}
return 0;
}