fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct Point {
  5. double x, y;
  6. };
  7.  
  8. int t;
  9. Point A, B;
  10.  
  11. double dist(Point A, Point B) {
  12. return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
  13. }
  14.  
  15. int main() {
  16. cin >> t;
  17. while (t--) {
  18. cin >> A.x >> A.y >> B.x >> B.y;
  19. A.y = abs(A.y);
  20. B.y = abs(B.y);
  21.  
  22. Point antiB;
  23. antiB.x = B.x;
  24. antiB.y = -B.y;
  25.  
  26. int res = dist(A, antiB);
  27. cout << res << "\n";
  28. }
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty