結果
問題 |
No.1319 最強とんがりコーン
|
ユーザー |
|
提出日時 | 2020-12-08 11:42:42 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 7,226 ms |
コンパイル使用メモリ | 252,024 KB |
最終ジャッジ日時 | 2025-01-16 19:36:13 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 67 TLE * 3 |
ソースコード
#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; assert(r<=10000.0 && h<=10000.0); assert(d <= 2.0*r); 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); }