3866 - Cylinder Candy

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

Description

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 rhd in one line. (1≤ rhd ≤ 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

迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方……

题意:用巧克力包裹一个圆柱形状的糖果,要求包裹的厚度为d,即包裹后外层距离糖果距离都是d。
给出糖果的高度,底面的半径,与d。
求包裹之后的体积和表面积。

只要你的高数不错,这道题做起来就很简单了,所以……
我被卡在了根号下(a^2-x^2)的原函数这一步了,o(╯□╰)o、用了两个小时,最终终于算出来了,数学题目,一次AC!

#include <iostream>
#include <cmath>
#include <stdio.h>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <memory.h>
#define PI acos(-1)
using namespace std;
int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        double r,h,d;
        cin>>r>>h>>d;
        double v,s;
        v=2.0*PI*(d*d*r*PI/2.0+2.0/3.0*d*d*d+r*r*d)+(r+d)*(r+d)*h*PI;
        s=2.0*PI*(2*d*d+PI*r*d)+2*PI*r*r+2*PI*(r+d)*h;
        printf("%.12lf %.12lf\n",v,s);
    }
    return 0;
}

ZOJ 3866 - Cylinder Candy的更多相关文章

  1. ZOJ - 3866 Cylinder Candy 【数学】

    题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3866 思路 积分 参考博客 https://blog.csdn. ...

  2. zoj 3866

    G - Cylinder Candy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Su ...

  3. Cylinder Candy(积分+体积+表面积+旋转体)

    Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...

  4. Cylinder Candy(积分)

    Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...

  5. 【ZOJ 3897】Candy canes//Fiddlesticks

    题 题意 给你一串数,a1...an,从左到右每次让一个数减小c,如果这个数小于c,那就减为0.第n个数减小后,又从第一个开始从左到右.如果这次某个数减小到0,那就改变方向,如果遇到已经是0的,就跳过 ...

  6. ZOJ People Counting

    第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ  3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...

  7. [LeetCode] Candy 分糖果问题

    There are N children standing in a line. Each child is assigned a rating value. You are giving candi ...

  8. ZOJ 3686 A Simple Tree Problem

    A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each no ...

  9. ZOJ Problem Set - 1394 Polar Explorer

    这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...

随机推荐

  1. 11G中自动收集统计信息

    在11G中,引入了一个名为 gather_stats_prog 的自动运行任务专用于自动收集统计信息.其对应的客户端名称为"auto optimizer stats collection&q ...

  2. iOS 延迟执行

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(<#delayInSeconds#> * NSEC_PER_SEC)), ...

  3. Swift实战-QQ在线音乐(AppleWatch版)

    1.打开项目QQMusic,然后点菜单:“File-New-Target”添加appleWatch扩展项 2.选择Swift语言,把Include Notification Scene前的勾去掉 (项 ...

  4. Codeforce Round #216 Div2

    e,还是写一下这次的codeforce吧...庆祝这个月的开始,看自己有能,b到什么样! cf的第二题,脑抽的交了错两次后过了pretest然后system的挂了..脑子里还有自己要挂的感觉,果然回头 ...

  5. 树形DP(简单题)(Y HDU4705)

    题意:给出一个n个节点的树形图,统计{A,B,C}的数量,其中ABC分别是树上三个不同的节点,并且这三个节点不能被一条路径覆盖 分析:对于下图 进行dfs深搜统计,num[u]统计回溯到当前节点u,并 ...

  6. Python学习总结9:目录操作方法汇总

    os.getcwd():得到当前工作目录,即当前Python脚本工作的目录路径os.listdir():返回指定目录下的所有文件和目录名os.remove():函数用来删除一个文件os.removed ...

  7. VS2010程序打包

    今天,小白就来给各位做个打包的新手教程,此文仅是为了记录自己的学习过程与方便其他初次接触的打包的朋友们总结一下,希望大家能够受用.废话不多说,下面我们就来讲解下打包工程.首先,在项目中添加一个安装项目 ...

  8. SharedPreferences 轻型的数据存储方式

    //初始化,(名字,隐私或公开) SharedPreferences openTimes=getSharedPreferences("openTimes",0); //提交保存数据 ...

  9. [div+css]网站布局实例二

    重点: 合理应用"xhtml标签"建立良好的页面结构 拿到一份"设计方案"的效果图后不要立即开始编码,而是要 首先理清"各元素之间的关系"; ...

  10. 关于 屏幕阅读器 和 sr-only

    .sr-only = screen reader only 用于读屏器识别使用.