@inkysakura
2017-04-25T22:47:09.000000Z
字数 329
阅读 1352
CODE
#include <bits/stdc++.h>
using namespace std;
int T,n,m,ncase;
int main()
{
cin >>T;
while(T--)
{
scanf("%d%d",&n,&m);
cout<<"Case "<<++ncase<<": ";
if(min(n,m)==1)printf("%d\n",max(n,m));
else if(min(n,m)==2)printf("%d\n",max(n,m)/4*4+2*min(2,max(n,m)%4));
else if((n*m)&1)
printf("%d\n",(n*m)/2+1);
else printf("%d\n",(n*m)/2);
}
return 0;
}