Problem link
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main() {
int ntest;
cin >> ntest;
for (int test=1; test<=ntest; test++)
{
int n,m;
cin >> n >> m;
n-=2; m-=2;
int col=m/3;
if (m%3!=0) col++;
int row=n/3;
if (n%3!=0) row++;
cout << (long long)col*row << endl;
}
return 0;
}
No comments:
Post a Comment