1904:求松鼠啃掉木头的体积。
[img]http://dl.iteye.com/upload/attachment/524664/135d1272-e869-3e6d-a9b4-fdabf5eb779a.jpg[/img]
圆台体积:1/3 * PI *H(R*R+R*r+r*r)
推出公式 V = PI/6*(D*D*D-d*d*d)
[img]http://dl.iteye.com/upload/attachment/524664/135d1272-e869-3e6d-a9b4-fdabf5eb779a.jpg[/img]
圆台体积:1/3 * PI *H(R*R+R*r+r*r)
推出公式 V = PI/6*(D*D*D-d*d*d)
#include<stdio.h>
#include<math.h>
#include<stdio.h>
#include<iostream>
using namespace std;
#define PI 3.1415927
int main()
{
double D;
double d;
double V;
while(1)
{
cin>>D;
cin>>V;
if(D==0&&V==0)
break;
printf("%.3f\n",pow(pow(D,3)-6*V/PI,1.0/3));
}
}