| 比赛 | 2022级数学专题练习赛7 | 评测结果 | AAAAAAAAAA | 
    | 题目名称 | 象棋中的皇后 | 最终得分 | 100 | 
    | 用户昵称 | yrtiop | 运行时间 | 0.000 s | 
    | 代码语言 | C++ | 内存使用 | 0.00 MiB | 
    | 提交时间 | 2023-01-30 20:19:03 | 
显示代码纯文本
#include <bits/stdc++.h>
using LL = __int128;
const int maxn = 1e6 + 5;
LL read() {
	LL s = 0,f = 1;
	char c = getchar();
	for(;c < '0'||c > '9';c = getchar())
		if(c == '-')f = -1;
	for(;c >= '0'&&c <= '9';c = getchar())
		s = (s << 1) + (s << 3) + (c ^ '0');
	return s * f;
}
void write(LL x) {
	if(x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
	return ;
}
int main() {
	freopen("chessqueen.in","r",stdin);
	freopen("chessqueen.out","w",stdout);
	LL n = read(),m = read();
	if(n > m)
		std::swap(n , m);
	write(n * m * (m + n - 2) + 2 * (2 * ((n - 1) * n * (2 * n - 1) / 6 - n * (n - 1) / 2) + (m - n + 1) * n * (n - 1)));
	return 0;
}