题解 | #牛牛的水杯#
牛牛的水杯
https://www.nowcoder.com/practice/c196c47c23394bf3bdd4f82a838df6bf
#include <stdio.h> #include <math.h> #define PI 3.14 int main() { int h,r; scanf("%d %d",&h,&r); float v = PI * h * r *r*0.001; int n = (int)10/v; if(10%v != 0) //浮点数相除不能直接用/,/是整数运算符,浮点数相除应该用数学库中的fmod n = (int)(10/v) +1; printf("%d\n",n); return 0; }