fork download
  1. #include <cstdio>
  2. #include <cmath>
  3. double r1, r2, r, ans;
  4. int main() {
  5. scanf("%lf%lf", &r1, &r2);
  6. r = r1 < r2 ? r1 : r2;
  7. double delta = (double) r / 50000000;
  8. for(double base = delta; base <= r; base += delta) {
  9. ans += sqrt(r1 * r1 - base * base) * sqrt(r2 * r2 - base * base);
  10. }
  11. printf("%.8lf\n", ans * 8 * delta + r1 * r2 * delta * 4);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 1.87s 3348KB
stdin
100 100
stdout
5333333.33333501