Advertisement
sbrotee63

Untitled

Mar 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i, t;
  5. long long r1, c1, r2, c2, sum1, sum2;
  6. scanf("%d", &t);
  7. for(i=0;i<t;i++)
  8. {
  9. scanf("%lld %lld %lld %lld", &r1, &c1, &r2, &c2);
  10. sum1=r1+c1;
  11. sum2=r2+c2;
  12. if((sum1%2==0&&sum2%2==0)||(sum1%2!=0&&sum2%2!=0))
  13. {
  14. if(sum1==sum2||(r1==c1&&r2==c2)||(r1==c1+2&&r2==c2+2)||(r1==c1+1&&r2==c2+1))
  15. printf("Case %d: 1\n", i+1);
  16. else
  17. printf("Case %d: 2\n", i+1);
  18. }
  19. else
  20. printf("Case %d: impossible\n", i+1);
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement