题解 | #牛牛的水杯#
牛牛的水杯
https://www.nowcoder.com/practice/c196c47c23394bf3bdd4f82a838df6bf
#include <stdio.h>
#include <math.h>
#define n 3.14
int main()
{
int h,r,m;
float a=0;
scanf("%d %d",&h,&r);
a=10000/(n*h*r*r);
m=(int)a;
if((10000-m*n*h*r*r)>1e-5)
{
m=m+1;
}
printf("%d",m);
return 0;
}
#include <math.h>
#define n 3.14
int main()
{
int h,r,m;
float a=0;
scanf("%d %d",&h,&r);
a=10000/(n*h*r*r);
m=(int)a;
if((10000-m*n*h*r*r)>1e-5)
{
m=m+1;
}
printf("%d",m);
return 0;
}
查看8道真题和解析