結果

問題 No.1319 最強とんがりコーン
ユーザー t33f
提出日時 2020-12-16 22:24:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 573 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 89,428 KB
最終ジャッジ日時 2025-01-17 02:05:08
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 70
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
    double R, H, D; cin >> R >> H >> D;
    double ans = 0;
    const double hmax = H * (1 - D / 2 / R),
        dh = H * 1e-7;
    for (double h = dh * 0.5; h < hmax; h += dh) {
        const double rh = R * (1 - h / H),
            theta = 2 * acos(D / 2 / rh);
        ans += dh * rh * rh * (theta - sin(theta));
    }
    cout << setprecision(12) << ans << endl;
}
0