結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    double r, h, d;
    cin >> r >> h >> d;
    d /= 2 * r;
    const int split = 1000000;
    double s = 0;
    for (int i = 1; i <= split; i++) {
        double r_i = double(i) / split, v = i % 2 * 2 + 2;
        if (i == split) v = 1;
        if (d >= r_i) continue;
        double theta = acos(d / r_i);
        s += 2 * v * (r_i * r_i * theta - d * r_i * sin(theta));
    }
    cout << setprecision(17) << s * r * r * h / (3 * split) << endl;
}
0