結果

問題 No.1319 最強とんがりコーン
コンテスト
ユーザー くれちー
提出日時 2020-12-16 03:56:19
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 758 ms / 2,000 ms
+ 209µs
コード長 731 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,160 ms
コンパイル使用メモリ 251,016 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-20 01:24:42
合計ジャッジ時間 55,950 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 70
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <boost/math/constants/constants.hpp>
#include <boost/math/quadrature/gauss.hpp>
#include <cmath>
#include <iostream>

int main() {
  double R, H, D;
  std::cin >> R >> H >> D;
  auto r = [=](const double& y) {
    return R * y / H;
  };
  auto t = [=](const double& y) {
    auto r_y = r(y);
    return boost::math::constants::pi<double>() - std::acos(1.0 - D * D / (2.0 * r_y * r_y));
  };
  auto s = [=](const double& y) {
    auto r_y = r(y);
    auto t_y = t(y);
    return r_y * r_y * (t_y - std::sin(t_y));
  };
  double a = H * D / (2.0 * R);
  double b = H;
  double ans = boost::math::quadrature::gauss<double, 10000>::integrate(s, a, b);
  std::cout << std::fixed << std::setprecision(10) << ans << std::endl;
}
0