結果

問題 No.1319 最強とんがりコーン
ユーザー DaYuanChi
提出日時 2021-01-21 20:36:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 500 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 1,923 ms
コンパイル使用メモリ 165,588 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 01:26:30
合計ジャッジ時間 30,911 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 70
権限があれば一括ダウンロードができます

ソースコード

diff #

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

double r, h, d;

//断面積S
double S(double x){
  return 2*x*x*acos(d/(2.0*x))-d*sqrt(x*x-d*d/4);
}

int main(){
  cin >> r >> h >> d;
  double range = r - d*0.5;
  int num = 10000000;
  double dr = range / num;
  double vol = 0;
  for(int i = 0; i < num; i++){
    vol += h/r*(S(d*0.5+i*dr)+S(d*0.5+(i+1)*dr))*dr/2;
  }
  printf("%.10f\n",vol);
  return 0;
}
    
  
0