Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i,j,t;
- cin>>t;
- for(i=0;i<t;i++)
- {
- int x,y;
- cin>>x>>y;
- if((x==1)||(y==1))
- {
- cout<<"Case "<<i+1<<": "<<x*y<<endl;
- }
- else if((x%2!=0)&&(y%2!=0))
- {
- cout<<"Case "<<i+1<<": "<<((x*y)/2)+1<<endl;
- }
- else if((x%2==0)&&(y%2==0))
- {
- cout<<"Case "<<i+1<<": "<<(x*y)/2<<endl;
- }
- else if((x%2==0)&&(y%2!=0))
- {
- cout<<"Case "<<i+1<<": "<<((x*y)/2)<<endl;
- }
- else if((x%2!=0)&&(y%2==0))
- {
- cout<<"Case "<<i+1<<": "<<((x*y)/2)<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement