/*
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
int main()
{
double r,s;
while(~scanf("%lf",&r))
{
s=4*PI*pow(r,3)/3;
printf("%.0lf\n",s); //直接进行整数位的四舍五入
}
return 0;
}
//运行正确
*/
/*
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
int main()
{
double r,s;
int m;
while(~scanf("%lf",&r))
{
s=4*PI*pow(r,3)/3;
m=int(s+0.5); //间接进行四舍五入
printf("%d\n",m); //直接进行整数位的四舍五入
}
return 0;
}
//运行正确
*/
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
int main()
{
double r,s;
while(~scanf("%lf",&r))
{
s=4*PI*pow(r,3)/3;
printf("%d\n",int(s)); //未进行四舍五入
return 0;
}
//运行出错
NYOJ计算球体积----四舍五入
最新推荐文章于 2021-05-22 14:59:37 发布