結果

問題 No.1319 最強とんがりコーン
ユーザー butsurizukibutsurizuki
提出日時 2020-12-08 11:40:11
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 583 bytes
コンパイル時間 6,680 ms
コンパイル使用メモリ 251,520 KB
最終ジャッジ日時 2025-01-16 19:34:34
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 68 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define dvd 100000000

using namespace std;

//https://mathworld.wolfram.com/Circle-CircleIntersection.html
double f(double r,double d){
  if(2*r <= d){return 0.0;}
  double ac=acos(d/(2.0*r)),res,subt;
  res=2.0*r*r*ac;
  subt=0.5*d;
  subt*=sqrt((4.0*r*r-d*d));
  return res-subt;
}

int main(){
  double r,h,d,res=0.0;
  double s1,s2,bh;
  cin >> r >> h >> d;
  bh=(h/(double)dvd);
  s1=f(r,d);
  for(int i=1;i<=dvd;i++){
    double cr=r*(((double)(dvd-i))/((double)dvd));
    s2=f(cr,d);
    res+=(s1+s2);
    s1=s2;
  }
  printf("%.12lf\n",res*bh/2.0);
}
0