ZOJ 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 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
迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方……
#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的更多相关文章
- ZOJ - 3866 Cylinder Candy 【数学】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3866 思路 积分 参考博客 https://blog.csdn. ...
- zoj 3866
G - Cylinder Candy Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Su ...
- Cylinder Candy(积分+体积+表面积+旋转体)
Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...
- Cylinder Candy(积分)
Cylinder Candy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Edward the confectioner is ...
- 【ZOJ 3897】Candy canes//Fiddlesticks
题 题意 给你一串数,a1...an,从左到右每次让一个数减小c,如果这个数小于c,那就减为0.第n个数减小后,又从第一个开始从左到右.如果这次某个数减小到0,那就改变方向,如果遇到已经是0的,就跳过 ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- [LeetCode] Candy 分糖果问题
There are N children standing in a line. Each child is assigned a rating value. You are giving candi ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
随机推荐
- define 实例
// ----------------------------------------------define------------------------------------- // #def ...
- IOS 加载Xib 后 如何 动态修改xib中的控件frame
看看xib里view是不是设置了自动布局 use auto layout.取消掉就可以了.
- Leetcode: Convert a Number to Hexadecimal
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's compl ...
- ACM之Java速成(2)
acm中Java的应用 Chapter I. Java的优缺点各种书上都有,这里只说说用Java做ACM-ICPC的特点: (1) 最明显的好处是,学会Java,可以参加Java Challenge ...
- 压缩 & 解压缩 命令汇总:tar、zip & unzip、
1. tar命令详解 格式:tar [-cxtzjvfpPN] 文件与目录 -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五 ...
- Linux内核之旅 链表实现
#include "stdio.h" #include "stdlib.h" struct list_head{ struct list_head *prev; ...
- js 实现精确加减乘除
//加法 function accAdd(arg1, arg2) { var r1, r2, m; try { r1 = arg1.toString().split(".")[1] ...
- 管理科学与工程 国内核心期刊 国外a刊及SCI
国内: 管理科学与工程: 管理科学学报 A+ (匿名审稿,绝对牛刊,不比一般的SCi期刊的质量差) 系统工程理论与实践 A (实名审稿,关系稿很多,尤其是挂编委的文章很多,但质量尚可)系统工程 ...
- 二项分布 多项分布 伽马函数 Beta分布
http://blog.csdn.net/shuimu12345678/article/details/30773929 0-1分布: 在一次试验中,要么为0要么为1的分布,叫0-1分布. 二项分布: ...
- 常用的DC插头公头的尺寸
2.0*0.6mm:这种应该是用在诺基亚黑白屏那种手机上的充电插头 2.5*0.7mm:这种不知用在哪里 3.5*1.35mm:应该是以前那种小型的磁带机放音机上用的 4.0*1.7mm:已知 ora ...