2002 ACM 杭电 计算球体积

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2002
注意,要用double 才能过,float过不了。
体积公式要加括号(优先级别)(4 * Π * r * r * r)/3

#include <stdio.h>
#define PI 3.1415927

int main()
{
    double r, v;
    while(~scanf("%lf", &r))
    {
        v = (4 * PI * r * r * r)/3;
        printf("%.3lf\n", v);
    }
}

猜你喜欢

转载自blog.csdn.net/weixin_42100472/article/details/81591168