2013-team5/andrew/13/H

从 Trac 迁移的文章

这是从旧校内 Wiki 迁移的文章,可能存在一些样式问题,您可以向 memset0 反馈。

原文章内容如下:

{{{
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>

int main() {
    freopen("sand.in", "r", stdin);
    freopen("sand.out", "w", stdout);
    double h, r, s, m;
    scanf("%lf%lf%lf%lf", &h, &r, &s, &m);
    for (int i = m; i >= 1; i --) {
        double ret = s * pow((double)i / m, 1.0 / 3.0) * sqrt(h * h + r * r) / h;
        printf("%.20f\n", ret);
    }
    fclose(stdin); fclose(stdout);
    return 0;
}
}}}
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
int main() {
    freopen("sand.in", "r", stdin);
    freopen("sand.out", "w", stdout);
    double h, r, s, m;
    scanf("%lf%lf%lf%lf", &h, &r, &s, &m);
    for (int i = m; i >= 1; i --) {
        double ret = s * pow((double)i / m, 1.0 / 3.0) * sqrt(h * h + r * r) / h;
        printf("%.20f\n", ret);
    }
    fclose(stdin); fclose(stdout);
    return 0;
}