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. pyOpenSSL0.13安装失败

    /usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'zip_safe' war ...

  2. mysql:批量更新

    (优化前)一般使用的批量更新的方法: foreach ($display_order as $id => $ordinal) {     $sql = "UPDATE categori ...

  3. 原来现在很多人都用SignalR来实现Chat Room

    今天从一个业余开发的群里,看到有人要求这样一个项目需求: 1,)学员可以通过在线课堂找到自己喜欢的老师和课程. 2,)每个人可以建立自己课堂,每个课堂扣分多个子房间,交流群.设置管理员:有录音功能,可 ...

  4. 仅使用处理单个数字的I/O例程,编写一个过程以输出任意实数(可以是负的)

    题目取自:<数据结构与算法分析:C语言描述_原书第二版>——Mark Allen Weiss   练习1.3 如题. 补充说明:假设仅有的I/O例程只处理单个数字并将其输出到终端,我们将这 ...

  5. typedef NS_OPTIONS 位移的枚举

    typedef NS_OPTIONS里面的枚举可以并存使用  用 | 来并存

  6. C#面向对象的方法写数组的功能

    上一篇文章用Java方法写出了可以对数组执行的功能,然后在用实例化后的对象调用这些方法来实现这些功能: 这篇随笔改用C#语言实现同样的功能 方法类:Array using System; using ...

  7. 常见的appbug(转)

    移动App Bug的影响是用户体验差.App的商店评级下降.用户换用竞争对手的App,声誉和信誉损失.最后销售量减少,如果它是一个付费App的话. 移动App测试与传统台式机测试相比有一定的复杂性.这 ...

  8. javaIO整理

    写在前面:本文章基本覆盖了java IO的全部内容,java新IO没有涉及,因为我想和这个分开,以突出那个的重要性,新IO哪一篇文章还没有开始写,估计很快就能和大家见面.照旧,文章依旧以例子为主,因为 ...

  9. windows系统调用 进程终止

    #include "windows.h" #include "iostream" #include "stdio.h" using name ...

  10. 夺命雷公狗—angularjs—6—单条数据的遍历

    我们在实际的工作中常常会处理到一些数据的遍历,这些数据都是后端传到前端的,有些公司会让前端帮忙处理一点遍历的工作,废话不多说,直接上代: <!doctype html> <html ...