日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > Acdream 1234 Two Cylinders(自適應辛普森積分法)

Acdream 1234 Two Cylinders(自適應辛普森積分法)

來源:程序員人生   發布時間:2016-08-17 10:32:45 閱讀次數:2422次

傳送門
Two Cylinders
Special Judge Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)
Submit Statistic Next Problem
Problem Description

  In this problem your task is very simple.
  Consider two infinite cylinders in three-dimensional space, of radii R1 and R2 respectively, located in such a way that their axes intersect and are perpendicular.
  Your task is to find the volume of their intersection.

Input

  Input file contains two real numbers R1 and R2 (1 <= R1,R2 <= 100).

Output

  Output the volume of the intersection of the cylinders. Your answer must be accurate up to 10⑷.

Sample Input

1 1
Sample Output

5.3333
Source

Andrew Stankevich Contest 3
Manager

mathlover

題目大意:
給了兩個圓柱的半徑 r1,r2,他們的軸線垂直相交,讓你求的是相交部份的體積。

解題思路:
這個題目首先我們對其積分:得到1個公式:

r0r12?x2????????r22?x2???????dy

我們現在用正常的積分公式積不出來,我們就能夠采取辛普森積分法進行積分,可以當作模板用
My Code:

/** 求兩個交叉圓柱的體積 **/ #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> const double eps = 1e⑼;///精度 using namespace std; double r1,r2; double f(double x)///積分函數 { return 8.0*(sqrt(r1*r1-x*x))*(sqrt(r2*r2-x*x)); } double simpson(double x,double y) { return (y-x)*(f(x)+f(y)+4*f((x+y)/2))/6.0; } double jifen(double x,double y)///積分區間[x,y] { double ans = simpson(x,y);///2分區間積分減小誤差 double mid = (x+y)/2.0; double left = simpson(x,mid); double right = simpson(mid,y); if(fabs(ans-(left+right)) < eps) return ans; return jifen(x,mid)+jifen(mid,y); } int main() { while(~scanf("%lf%lf",&r1,&r2)) { if(r1<r2) swap(r1,r2); printf("%.6lf\n",jifen(0.0,r2)); } return 0; }

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 视频在线二区 | 久久精品国产久精国产 | 日韩成人精品视频 | 久久久亚洲国产 | 欧美午夜激情视频 | 日本精品视频一区二区 | 国产欧美日韩一区二区三区 | 婷婷六月丁 | 午夜精品一区二区三区在线视频 | 欧美亚洲国产日韩 | 精品在线免费视频 | 久久人人爽人人爽 | 91精品啪在线观看国产线免费 | 99久久夜色精品国产亚洲96 | 亚洲最大福利网站 | 中文字幕亚洲视频 | 国产一区二区欧美 | av片在线看| 久久久不卡 | 日本一区不卡 | 成人h视频在线观看 | 国产精品传媒麻豆hd | 精品久久久一区 | 国产免费一区二区三区在线能观看 | 午夜精品久久久久久久96蜜桃 | 精品中文在线 | 黄视频在线播放 | 国产精品成人一区 | 久久久久久久91 | 国产精品久久久久久久久免费蜜臀 | 国语成人 | 99久久精品国产毛片 | 亚洲一二三在线 | 日韩一区二区三区精品视频 | 亚洲第一免费播放区 | 高清av在线| 欧美福利视频 | 亚洲成人高清在线 | 麻豆免费视频 | 国产成人黄色 | 紧缚调教一区二区三区视频 |