题解 | #牛牛的水杯#
牛牛的水杯
https://www.nowcoder.com/practice/c196c47c23394bf3bdd4f82a838df6bf
//1升==1立方分米==1000立方厘米 #include <stdio.h> #include <math.h>//使用pow函数需要引入该头文件 int main() { int r = 0; int h = 0; scanf("%d%d", &h, &r); float V = (3.14*h*pow(r,2))/1000;//pow(x,y) == x的y次方 //pow返回的值是double类型的 if(10.0 / V == 0)//如果被整除就不用 + 1 { printf("%d\n",(int)(10 / V)); } else { printf("%d\n",(int)(10 / V)+1); } return 0; }