fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. #define PI 3.1415926535897932385
  5. #define min(a,b) ((a)<(b)?(a):(b))
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. int t;
  12. cin >> t;
  13. while(t--)
  14. {
  15. double w,h;
  16. cin >> w >> h;
  17.  
  18. double r1 = w/(2.0*PI);
  19. double h1 = h - 2.0*r1;
  20. double r2 = min(h/(2.0*(PI+1.0)),w/2.0);
  21. double h2 = w;
  22. double v1 = PI*r1*r1*h1;
  23. double v2 = PI*r2*r2*h2;
  24. cout << setprecision(12) << fixed << (v1>v2?v1:v2) << endl;
  25. }
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 3276KB
stdin
3
4 4
2 3
1 6
stdout
3.471819240663
0.824190535860
0.785398163397