解题思路:水题目一枚,直接代码吧,注意的是最外面边界不用考虑
the border cells do not need to be controlled, because Nessy cannot hide there (she is too big).
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int n,m,t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m);
int a,b;
a=b=0;
if((n-2)%3)
{
a=(n-2)/3+1;
}
else
{
a=(n-2)/3;
}
if((m-2)%3)
{
b=(m-2)/3+1;
}
else
{
b=(m-2)/3;
}
printf("%d\n",a*b);
}
return 0;
}