Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. long long r1,r2,l1,l2;
  5. int main()
  6. {
  7. cin>>l1>>r1>>l2>>l2;
  8. if(l1>r1) swap(l1,r1);
  9. if(l2>r2) swap(l2,r2);
  10. if(l1<l2) swap(l1,l2);
  11. if(r1<r2) swap(r1,r2);
  12.  
  13. if(r2<l1) cout<<0;
  14. else cout<<r2-l1<< endl;
  15. return 0;
  16. }
  17. // r2-l1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement