fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. double t, p, s;
  9. cin>>t;
  10. while(t--) {
  11. cin>>p>>s;
  12. cout<<fixed<<setprecision(2)<<(pow((p-(sqrt(pow(p, 2)-(24*s))))/12, 2)*((p/4)-(2*((p-(sqrt(pow(p, 2)-(24*s))))/12))))<<endl;
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 3432KB
stdin
2
20 14
20 16
stdout
3.00
4.15