Maruf_Hasan

bishop

Dec 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. int t,j=0;
  8. cin>>t;
  9. while(j<t)
  10. {
  11.  
  12. long long r1,c1,r2,c2,dis;
  13. cin>>r1>>c1>>r2>>c2;
  14. dis=abs(r2-r1)+abs(c2-c1);
  15. if(dis%2!=0)
  16. {
  17. printf("Case %d: impossible\n",j+1);
  18. }
  19. else
  20. {
  21. long long x,y;
  22. x=r1+c1;
  23. y=r2+c2;
  24. if(r1==c1 && r2==c2)
  25. {
  26. printf("Case %d: 1\n",j+1);
  27. }
  28. else if(x==y)
  29. {
  30. printf("Case %d: 1\n",j+1);
  31. }
  32. else
  33. {
  34. printf("Case %d: 2\n",j+1);
  35. }
  36. }
  37. j++;
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment