CodeChef SHGAME
#include <bits/stdc++.h>
#define int long long
using namespace std;
int tong1[2323233], tong2[2323233];
signed main()
{
int T;
cin >> T;
while (T --)
{
int n, m;
cin >> n >> m;
n --;
m --;
memset (tong1, 0, sizeof tong1);
memset (tong2, 0, sizeof tong2);
for (int i = 0; i <= n; i ++)
tong1[i ^ (n - i)] ++;
for (int i = 0; i <= m; i ++)
tong2[i ^ (m - i)] ++;
int res = (n + 1) * (m + 1);
for (int i = 0; i <= 1e6; i ++)
res -= tong1[i] * tong2[i];
cout << res << '\n';
}
return 0;
}
本文来自博客园,作者:yhbqwq,转载请注明原文链接:https://www.cnblogs.com/yhbqwq/p/16823856.html,谢谢QwQ