fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct Point {
  5. double x, y;
  6. };
  7.  
  8. double dist(Point A, Point B) {
  9. return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
  10. }
  11.  
  12. double Area(Point A, Point B, Point C) {
  13. double a = dist(A, B);
  14. double b = dist(A, C);
  15. double c = dist(B, C);
  16. double p = (a + b + c) / 2;
  17. return sqrt(p * (p - a) * (p - b) * (p - c));
  18. }
  19.  
  20. double getR(Point A, Point B, Point C) {
  21. double a = dist(A, B);
  22. double b = dist(A, C);
  23. double c = dist(B, C);
  24. return (a * b * c) / 4 * Area(A, B, C);
  25. }
  26.  
  27. int main() {
  28. Point A, B, C;
  29. cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
  30. cout << setprecision(2) << fixed << Area(A, B, C) << '\n';
  31. cout << setprecision(2) << fixed << getR(A, B, C);
  32. }
  33.  
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
0.00
0.00