Guest User

Untitled

a guest
Oct 17th, 2020
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.  
  9. int t;
  10. int c=0,c1=0;
  11. cin>>t;
  12. while(t--)
  13. {
  14.  
  15. int x1,y1,x2,y2;
  16. cin>>x1>>y1>>x2>>y2;
  17.  
  18. if(x1++==x2 && y1==y2)
  19. cout<<"1"<<endl;
  20. else if(y1++==y2 && x1==x2)
  21. cout<<"1"<<endl;
  22.  
  23. else
  24. {
  25. while(x1!=x2)
  26. {
  27. x1++;
  28. c++;
  29. //if(x1==x2)
  30. //break;
  31. //printf("c=%d ",c);
  32. }
  33.  
  34. while(y1!=y2-1)
  35. {
  36. y1++;
  37. c1++;
  38.  
  39. //if(y1==y2)
  40. //break;
  41. //cout<<"c="<<c1<<" ";
  42. }
  43.  
  44. }
  45.  
  46.  
  47. cout<<c+c1+3<<endl;
  48.  
  49.  
  50. }
  51.  
  52.  
  53.  
  54.  
  55. return 0;
  56. }
  57. wht is wrong my code why it did not get ac ?
Add Comment
Please, Sign In to add comment