60WA求助
查看原帖
60WA求助
857323
linxuanrui楼主2023/5/27 21:01
#include<bits/stdc++.h>
typedef unsigned long long ll;
using namespace std;
ll t,n,m;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> t;
	while(t--){
		cin >> n >> m;
		ll sum = 4ll * ceil(n * m / 2.0) - m - n - (m % 2 == 1 && n % 2 == 1 ? 2 : 0);
		cout << sum << endl;
	}
}

考试时手推的公式,不知道哪里错了。

2023/5/27 21:01
加载中...