fork download
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781641;
  7.  
  8. int main() {
  9. double a, b, c, r;
  10. cin >> a >> b >> c >> r;
  11. double p = (a + b + c) / 2;
  12. double S = sqrt(p * (p-a) * (p-b) * (p-c));
  13. double R = S / p;
  14. double coef = r / R;
  15. double saved = coef * coef * (S - PI*R*R);
  16. printf("%.15f\n", (S - saved) / S);
  17. }
  18.  
Success #stdin #stdout 0s 3432KB
stdin
6 8 10 1
stdout
0.880899693899575