B2029题解

· · 题解

桶的单位是厘米,喝水的单位是升?

升与立方厘米(ml)的进率是 1000

圆柱形体积计算公式:V=r^2 \times π \times h

本题 π3.14

最后注意桶数向上取整。

代码:

#include<bits/stdc++.h>
using namespace std;
#define PI 3.14
double r,h;
double b;
int main()
{
    cin >> h >> r;
    b=20000/(PI*r*r*h);
    cout << ceil(b) << endl;
    return 0;
}