#include<bits/stdc++.h>
using namespace std;
int main()
{
int x, y, t, i = 1;
cin >> t;
while(t--)
{
cin >> x >> y;
int c = 0;
if(x == 1 || y == 1)
{
c = max(x, y);
}
else if(x == 2 || y == 2)
{
int r = max(x, y);
c = r;
if(r%4 == 1 || r%4 == 3)
c++;
else if(r%4 == 2)
c+=2;
}
else
{
double d = (double)y/2.0;
c = ceil(x*d);
}
cout << "Case " << i++ << ": " << c << "\n";
}
return 0;
}
using namespace std;
int main()
{
int x, y, t, i = 1;
cin >> t;
while(t--)
{
cin >> x >> y;
int c = 0;
if(x == 1 || y == 1)
{
c = max(x, y);
}
else if(x == 2 || y == 2)
{
int r = max(x, y);
c = r;
if(r%4 == 1 || r%4 == 3)
c++;
else if(r%4 == 2)
c+=2;
}
else
{
double d = (double)y/2.0;
c = ceil(x*d);
}
cout << "Case " << i++ << ": " << c << "\n";
}
return 0;
}
Comments
Post a Comment