Advertisement
Saleh127

Lo 1077

Nov 27th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. test
  11. {
  12.  
  13. ll x1,x2,y1,y2,a,b,c;
  14. cin>>x1>>y1>>x2>>y2;
  15.  
  16. a=abs(x1-x2);
  17. b=abs(y1-y2);
  18. c=__gcd(a,b)+1;
  19.  
  20. cout<<"Case "<<cs<<": "<<c<<endl;
  21.  
  22.  
  23. }
  24.  
  25.  
  26. return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement