Advertisement
Guest User

Bishop.cpp

a guest
Sep 15th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. clude<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     ios::sync_with_stdio(false);cin.tie(0);
  6.     int t,c=0,v=1,v1=2;
  7.     cin>>t;
  8.     while(t--)
  9.     {
  10.         int x,y,x1,y1,ans,f,e;
  11.         c++;
  12.         cin>>x>>y>>x1>>y1;
  13.         cout<<"Case "<<c<<": ";
  14.         e=(x>=y)?(x-y):(y-x);f=(x1>=y1)?(x1-y1):(y1-x1);
  15.         if((x+y)%2==0)
  16.         {
  17.  
  18.             if((x1+y1)%2!=0) cout<<"impossible"<<endl;
  19.             else if((x1+y1)%2==0 && e==f ) cout<<v<<endl;
  20.             else cout<<v1<<endl;
  21.  
  22.         }
  23.         else {
  24.              if((x1+y1)%2==0) cout<<"impossible"<<endl;
  25.             else if((x1+y1)%2!=0 && e==f) cout<<v<<endl;
  26.             else  cout<<v1<<endl;
  27.         }
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement