fork(1) download
  1. #include <bits/stdc++.h>
  2. #define pi 3.14159265359
  3. using namespace std;
  4.  
  5. int main() {
  6. long double a,b,c,r;
  7. cin >> a >> b >> c >> r;
  8. long double s =(a+b+c)/2;
  9. long double S =0;
  10. long double x =acos((a*a+b*b-c*c)/2/a/b)/2;
  11. S -=r*r/tan(x);
  12. S +=(pi-2*x)/2*r*r;
  13. x =acos((a*a+c*c-b*b)/2/a/c)/2;
  14. S -=r*r/tan(x);
  15. S +=(pi-2*x)/2*r*r;
  16. x =acos((b*b+c*c-a*a)/2/b/c)/2;
  17. S -=r*r/tan(x);
  18. S +=(pi-2*x)/2*r*r;
  19. cout << fixed << setprecision(10) << 1+S/sqrt(s*(s-a)*(s-b)*(s-c)) << "\n";
  20. return 0;}
Success #stdin #stdout 0s 3476KB
stdin
6 8 10 1 
stdout
0.8808996939