SHARE
TWEET

Untitled

a guest Dec 8th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i,j,t;
  6.     cin>>t;
  7.     for(i=0;i<t;i++)
  8.     {
  9.         int x,y;
  10.         cin>>x>>y;
  11.         if((x==1)||(y==1))
  12.         {
  13.             cout<<"Case "<<i+1<<": "<<x*y<<endl;
  14.         }
  15.  
  16.         else if((x%2!=0)&&(y%2!=0))
  17.         {
  18.             cout<<"Case "<<i+1<<": "<<((x*y)/2)+1<<endl;
  19.         }
  20.         else if((x%2==0)&&(y%2==0))
  21.         {
  22.             cout<<"Case "<<i+1<<": "<<(x*y)/2<<endl;
  23.         }
  24.         else if((x%2==0)&&(y%2!=0))
  25.         {
  26.             cout<<"Case "<<i+1<<": "<<((x*y)/2)<<endl;
  27.         }
  28.         else if((x%2!=0)&&(y%2==0))
  29.         {
  30.             cout<<"Case "<<i+1<<": "<<((x*y)/2)<<endl;
  31.         }
  32.     }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.     return 0;
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top