fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main(){
  6. double xA, yA, xB, yB, xC, yC; int h, S, AB, BC, AC;
  7. cin>>xA>>yA>>xB>>yB>>xC>>yC;
  8. AB = sqrt((xB-xA)*(xB-xA)+(yB-yA)*(yB-yA));
  9. BC = sqrt((xC-xB)*(xC-xB)+(yC-yB)*(yC-yB));
  10. AC = sqrt((xA-xC)*(xA-xC)+(yA-yC)*(yA-yC));
  11. {
  12. if((AB>BC+AC)&&(BC>AB+AC)&&(AC>AB+BC))
  13. {
  14. cout << ("Treygolnik ne syshestvyet");
  15. }
  16. else
  17. {
  18. S = fabs((xB-xA)*(yC-yA)-(xC-xA)*(yB-yA))/2.0;
  19. h = (2*S)/ BC;
  20. cout << BC << " " << h;
  21. }
  22. }
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 3432KB
stdin
98 67 56 47 34 95
stdout
52 47