fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7. long long a, b, c, d, e, f;
  8. cin >> a >> b >> c >> d >> e >> f;
  9. vector<long long> t1 = {a, b, c};
  10. vector<long long> t2 = {d, e, f};
  11. sort(t1.begin(), t1.end());
  12. sort(t2.begin(), t2.end());
  13. if (t1 != t2) {
  14. cout << -1;
  15. return 0;
  16. }
  17. long long x = t1[0], y = t1[1], z = t1[2];
  18. if (x + y <= z) {
  19. cout << -1;
  20. return 0;
  21. }
  22. if (!(x == y || y == z)) {
  23. cout << -1;
  24. return 0;
  25. }
  26. double p = (x + y + z) / 2.0;
  27. double v = sqrt(p * (p - x) * (p - y) * (p - z));
  28. double l = 2.0 * v;
  29. cout << fixed << setprecision(2) << l;
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5292KB
stdin
3 4 5 4 5 3
stdout
-1