Cylinder Candy(积分+体积+表面积+旋转体)
Cylinder Candy
Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge
Edward the confectioner is making a new batch of chocolate covered candy. Each candy center is shaped as a cylinder with radius r mm and height h mm.
The candy center needs to be covered with a uniform coat of chocolate. The uniform coat of chocolate is d mm thick.
You are asked to calcualte the volume and the surface of the chocolate covered candy.
Input
There are multiple test cases. The first line of input contains an integer T(1≤ T≤ 1000) indicating the number of test cases. For each test case:
There are three integers r, h, d in one line. (1≤ r, h, d ≤ 100)
Output
For each case, print the volume and surface area of the candy in one line. The relative error should be less than 10-8.
Sample Input
2
1 1 1
1 3 5
Sample Output
32.907950527415 51.155135338077
1141.046818749128 532.235830206285 经过这几天的思考,以及各种抓狂,我只能说数学老师就是牛,一语点了醒我!
好纠结,,,难道以后要背着高数跑。。。这是我最初的想法,然后经过求证,体积并不要减去里面的圆柱;
过程已经写得很详尽了。。。 转载请注明出处:
寻找&星空の孩子
题目链接:http://acm.zju.edu.cn/onlinejudge/contestInfo.do?contestId=361
#include<stdio.h>
#include<math.h>
#define PI acos(-1.0)
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
double r,h,d;
double v,s;
scanf("%lf%lf%lf",&r,&h,&d);
v=PI*PI*r*d*d+4.0/*PI*d*d*d+*PI*r*r*d+PI*h*((d+r)*(d+r));
s=*(PI*PI*r*d+*PI*d*d+PI*r*r+PI*h*(r+d));
printf("%.12lf %.12lf\n",v,s); }
return ;
}
Cylinder Candy(积分+体积+表面积+旋转体)的更多相关文章
- Cylinder Candy(积分)
Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...
- ZOJ 3866 - Cylinder Candy
3866 - Cylinder Candy Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu ...
- ZOJ - 3866 Cylinder Candy 【数学】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3866 思路 积分 参考博客 https://blog.csdn. ...
- 3D模型展示以及体积、表面积计算
本文原创 如转载请注明出处!!! 本博客地址http://www.cnblogs.com/we-jack 本文原创,如果有同样需求的小伙伴请第一时间联系我 或者在留言区留言 上次为大家提供了3D模型的 ...
- zoj 3866
G - Cylinder Candy Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Su ...
- java-7311练习(下)
java练习,仅供参考! 欢迎同学们交流讨论. JDK 1.8 API帮助文档 JDK 1.6 API中文文档 第一次小组作业:模拟双色球彩票 第一次小组作业(一) 控制台版 游戏规则: • 双色球为 ...
- Java【第七篇】面向对象之类设计
Java类的继承 类继承语法规则 < 修饰符> class < 子类名称> [extends < 父类>] { <属性和方法的声明> } 类的继承 子 ...
- Java 类设计----Java类的继承
Java类的继承 为描述和处理个人信息,定义类Person: public class Person { public String name; public inat age; public Dat ...
- c++学习--面向对象一实验
实验内容 一 建立类cylinder,cylinder的构造函数被传递了两个double值,分别表示圆柱体的半径和高度.用类cylinder计算圆柱体的体积,并存储在一个double变量中.在类cyl ...
随机推荐
- std::string的拷贝赋值研究
说明:以下涉及的std::string的源代码摘自4.8.2版本.结论:std::string的拷贝复制是基于引用计数的浅拷贝,因此它们指向相同的数据地址. // std::string类定义type ...
- MFC头文件
AFX.H struct CRuntimeClass; // object type information class CObject; // the root of all objects cla ...
- 1.2万事开头hello world+交互+getpass、sys模块初识
1.python的hello world: ①运行cmd-输入python-输入print (“hello world!”) ②创造.py的文本helloworld.py(后缀是为了告诉其他人)-输入 ...
- 修改VS 中的代码编辑颜色-Vs主题修改
有个性的开发人员总是喜欢使用属于的主题和配色方案,它们可以看出开发者的个性,更改它们可以缓解审美疲劳,总之选择一个适合自己的解决方案可能极大的增加自己的编码舒适度. 1. 配色方案的选择和使用 手动修 ...
- nginx 502错误 upstream sent too big header while reading response header from upstream
原本的设置是 proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; 在这种配置下,使用fiddler进行抓包分 ...
- c++ 日志输出库 spdlog 简介(1)
参考文章: log库spdlog简介及使用 - 网络资源是无限的 - CSDN博客 http://blog.csdn.net/fengbingchun/article/details/78347105 ...
- 收藏的blog
https://www.cnblogs.com/xifengxiaoma/tag/vue/ https://www.cnblogs.com/xifengxiaoma/p/9400200.html
- 微信小程序 web-view 的 url 带参问题
在微信小程序开发过程中,会需要跳转到外部链接,微信提供了 <web-view>组件供我们使用. 为减少重复代码,一般会将这个功能单独抽取为一个页面供大家使用: <template&g ...
- Python日常实践(1)——SQL Prompt的Snippets批量整理
引言 个人平时在写sql脚本的时候会使用到SQL Prompt这款插件,除了强大的智能提示和格式化sql语句功能,我还喜欢使用Snippets代码段功能.比如我们可以在查下分析器输入ssf后按Tab键 ...
- 关于 Spring Security 5 默认使用 Password Hash 算法
账户密码存储的安全性是一个很老的话题,但还是会频频发生,一般的做法是 SHA256(userInputpwd+globalsalt+usersalt) 并设置密码时时要求长度与大小写组合,一般这样设计 ...
这是我最初的想法,然后经过求证,体积并不要减去里面的圆柱;
过程已经写得很详尽了。。。
转载请注明出处: