zoj 3832 Tilt Cylinder
来源:互联网 发布:淘宝怎么提醒卖家发货 编辑:程序博客网 时间:2024/06/06 04:30
zoj 3832 Tilt Cylinder
题意:一个与地面倾角为a的密封的圆柱体,内部有高度为h的水,问水的体积。
分析:(1)做与地面为a的倾角的面,其与水面的截面应为一个矩形。
(2)设该面距离圆柱与地面的接触点的距离为x 则 0<x<min(2*r,h/cos(a))。
(3) 截面矩形的宽为l1=2*sqrt(r*r-(r-x)*(r-x)),高为h1=min(H,(h/cos(a)-x)/tan(a))
(4) v=(x)∑(l1*h1)
(5) 数值积分
#include<cstdio>#include<iostream>#include<cstring>#include<cstdlib>#include<cmath>#include<ctype.h>#include<algorithm>using namespace std;#pragma comment(linker,"/STACK:102400000,102400000")#define pi acos(-1.0)#define MOD 1000000007#define INF 0x3f3f3f3fdouble r,H,h,aa,l;double F(double x){ double l1=sqrt(r*r-(x-r)*(x-r)); double h1; if(fabs(aa)<1e-8) h1=H; else h1=min((l-x)/tan(aa),H); return l1*h1;}double simpson(double a,double b){ double c=a+(b-a)/2; return (F(a)+4*F(c)+F(b))*(b-a)/6;}double asr(double a,double b,double eps,double A){ double c=a+(b-a)/2; double L=simpson(a,c),R=simpson(c,b); if(fabs(L+R-A)<=15*eps) return L+R+(L+R-A)/15.0; return asr(a,c,eps/2,L)+asr(c,b,eps/2,R);}double asr(double a,double b,double eps){ return asr(a,b,eps,simpson(a,b));}int main(void){ while(scanf("%lf%lf%lf%lf",&r,&H,&h,&aa)!=EOF) { aa=aa/180*pi; if(fabs(aa-pi/2)<=1e-8) { printf("%.9f\n",pi*r*r*h); continue; } l=h/cos(aa); double x1=0; double x2=min(l,2*r); double ans=asr(x1,x2,1e-6); printf("%.9f\n",ans*2); } return 0;}
0 0
- zoj 3832 Tilt Cylinder
- ZOJ - 3832 Tilt Cylinder
- 【数值积分】 ZOJ 3832 Tilt Cylinder
- 【ZOJ】3832 Tilt Cylinder 积分题——simpson
- ZOJ Monthly, November 2014 - C Tilt Cylinder
- Tilt Cylinder
- ZOJ 3866 Cylinder Candy
- ZOJ 3866 Cylinder Candy
- ZOJ-3866 Cylinder Candy
- zoj 3866 Cylinder Candy
- ZOJ 3866 - Cylinder Candy
- ZOJ Problem Set - 3866 Cylinder Candy
- zoj 3866 Cylinder Candy(积分数学)
- ZOJ - 3866 Cylinder Candy (数学,积分)
- Cylinder
- ZOJ 3866 Cylinder Candy (浙大校赛+积分应用)
- ZOJ 3866 Cylinder Candy(对体积和表面积 积分)
- Cylinder oj55
- 如何做一个好梦
- bzoj 3760: suitang
- easy-UI的panel的refresh
- 用Geogebra制作一些动画效果,也是对数学基础的一次检验
- 第十四周项目一(1)——折腾二维数组
- zoj 3832 Tilt Cylinder
- VMware 安装centos 直接进行安装并没有出现设置界面的问题
- jquery 插件模版
- Eclipse背景颜色修改
- poj 3687 Labeling Balls
- SVN图标不能正常显示
- 【猪猪-后端】过滤IP格式工具类,将IP地址格式化,开发必备工具。
- 边记边学PHP-(十)PHP数组总结
- EM算法_混合高斯模型