POJ3737UmBasketella【圆锥体积与面积+求导】
2015-09-05 23:43
260 查看
Language:Default [align=center]UmBasketella[/align]
In recent days, people always design new things with multifunction. For instance, you can not only use cell phone to call your friends, but you can also use your cell phone take photographs or listen to MP3. Another example is the combination between watch and television. These kinds of multifunction items can always improve people's daily life and are extremely favored by users. The company Mr. Umbrella invented a new kind umbrella "UmBasketella" for people in Rainbow city recently and its idea also comes from such multifunction--the combination of umbrella and daily necessities. This kind of umbrella can be used as a basket and you can put something you want to carry in it. Since Rainbow city rains very often, such innovative usage is successful and "UmBasketella" sells very well. Unfortunately, the original "UmBasketella" do not have an automatic volume control technology so that it is easily damaged when users try to put too many things in it. To solve this problem, you are needed to design an "UmBasketella" with maximum volume. Suppose that "UmBasketella" is a cone-shape container and its surface area (include the bottom) is known, could you find the maximum value of the cone? Input Input contains several test cases. Eash case contains only one real number S, representing the surface area of the cone. It is guaranteed that 1≤S≤10000. Output For each test case, output should contain three lines. The first line should have a real number representing the maximum volume of the cone. Output the height of the cone on the second line and the radius of the bottom area of the cone on the third line. All real numbers should rounded to 0.01. Sample Input 30 Sample Output 10.93 4.37 1.55 |
圆锥体面积:S=PI*L*R+PI*R*R;L=sqrt(h*h+R*R);
既有R*R=S*S/(PI*PI*h*h+2*PI*S);
V=PI*R*R*h/3;将R*R带入求导函数零点即为最大值点;即可求出h,r,v
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #define PI 3.1415926 using namespace std; int main() { double s,h,r,v; while(scanf("%lf",&s)!=EOF){ r=sqrt(s/PI)/2.0; h=sqrt((s*s)/(PI*PI*r*r)-2.0*s/PI); v=PI*r*r*h/3.0; printf("%.2lf\n%.2lf\n%.2lf\n",v,h,r); } return 0; }
相关文章推荐
- deepin系统安装到运行第一个ruby程式
- 记录几个将来要看的问题
- poj2186 强连通分量+缩点
- 9.2总结
- 深入分析Java线程中断问题
- Elasticsearch、MongoDB和Hadoop比较
- iOS沙盒(sandBox)机制(一)之获取沙盒路径及目录说明
- 【各种系列教程】fms p2p视频教程 第一节安装已经运用
- HHvm建站环境搭建方法:Nginx,Mariadb,hhvm及lnmp/lamp安装部署 | 免费资源部落
- Web设计——初识HTML
- 详解OpenGL中的各种变换(投影变换,模型变换,视图变换)(二)——投影变换
- Java的位运算符详解——与(&)、非(~)、或(|)、异或(^)
- 流年,命运流沙
- 连载《一个程序猿的生命周期》-28、被忽悠来的单身HR(女同志)
- 二叉搜索树的c++实现(含深复制)
- 微信文章抓取接口
- iOS多线程学习之NSOperation(一)
- mac系统下读取移动硬盘的小问题
- Flood loader tester
- Effective C++——条款23(第4章)