You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
406 B
C++

#include <cstdio>
#include <cmath>
const double pi=acos(-1);
int main()
{
double R,r,H,S;
int F;
while(scanf("%lf%lf%lf%d%lf",&R,&r,&H,&F,&S)!=EOF)
{
double h=H/F,dr=(R-r)/F,ans=0;
for(int i=0; i<F; i++,r+=dr)
{
int n=pi/atan(S/2/h/r);
ans+=2*r*tan(pi/n)*n*h;
}
printf("%.3lf\n",ans);
}
return 0;
}