Advertisement
brightleaf

чебоксары

Jun 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. freopen("trianglearea.in","r", stdin);
  6. freopen("trianglearea.out","w", stdout);
  7. double x,y,a,b,c,x1,x2,y1,y2,p;
  8. cin >> x >> y >> x1 >> y1 >> x2 >> y2;
  9. a = sqrt(((x-x1)*(x-x1))+((y-y1)*(y-y1)));
  10. b = sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
  11. c = sqrt(((x2-x)*(x2-x))+((y2-y)*(y2-y)));
  12. p = (a+b+c)/2;
  13. if ((a+b<=c)||(c+b<=a)||(c+a<=b)) cout << -1;
  14. else {
  15. p = sqrt(p*(p-a)*(p-b)*(p-c));
  16. cout << fixed << setprecision(12) << p;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement