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. 线段树 Interval Tree

    一.线段树 线段树既是线段也是树,并且是一棵二叉树,每个结点是一条线段,每条线段的左右儿子线段分别是该线段的左半和右半区间,递归定义之后就是一棵线段树. 例题:给定N条线段,{[2, 5], [4, ...

  2. 在Ubuntu 64位OS上运行hadoop2.2.0[重新编译hadoop]

    最近在学习搭建Hadoop, 我们从Apache官方网站直接下载最新版本Hadoop2.2.官方目前是提供了linux32位系统可执行文件,结果运行时发现提示 “libhadoop.so.1.0.0 ...

  3. Activity之间的数据传递

    最常用的Activity之间的数据传递. btnStartAty1.setOnClickListener(new View.OnClickListener() { @Override public v ...

  4. Linux 系统结构

    Linux的系统结构一般由四部分组成 内核 1)内核 操作系统的核心,具有最基本的功能:内存管理.进程管理.设备驱动管理.文件系统管理,网络管理 内核版本(kernel)查看的三种方法 cat /pr ...

  5. ol,ul,dl,table标签的基本语法

    ol,ul,dl,table标签的基本语法 有序列表: 无序列表:                                  自定义列表: <ol> <ul> < ...

  6. 服务器 CentOS上yum安装Nginx服务

    一.更改yum源为网易的源加快速度 vi /etc/yum.repos.d/CentOS-Base.repo 更改内容如下 # CentOS-Base.repo # # This file uses ...

  7. spark读取hdfs数据本地性异常

    在分布式计算中,为了提高计算速度,数据本地性是其中重要的一环. 不过有时候它同样也会带来一些问题. 一.问题描述 在分布式计算中,大多数情况下要做到移动计算而非移动数据,所以数据本地性尤其重要,因此我 ...

  8. [Ubuntu] google chrome乱码

    问题描述 ubuntu14.04,之前google chrome一直都是好好的,升级过相关软件,之后就是乱码了,如图 经过google的努力,找到解决方法,原因未明. 解决方案 sudo /etc/f ...

  9. bug管理规范

    资源来自:http://wenku.baidu.com/view/ae55b3b565ce05087632132b.html

  10. FireDac 的数据库批量语句提交(高效)

    FD 提供了批量执行功能, 称为 Array DML. 可以这么做: FDQuery1.SQL.Text := 'insert into MyTab values (:p1, :p2, :p3)'; ...