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代码及总结这道题目的总结 题目要求 ...
随机推荐
- sql语句查询出数据重复,取唯一数据
select distinct mr.id,ifnull(mr.pid,0) as pid,mr.name from sys_role_res srr left join main_res mr on ...
- IntelliJ IDEA 常用设置讲解3
IntelliJ IDEA 有很多人性化的设置我们必须单独拿出来讲解,也因为这些人性化的设置让我们这些 IntelliJ IDEA 死忠粉更加死心塌地使用它和分享它. 常用设置 如上图 Gif 所示, ...
- How to debug PostgreSQL function with pgAdminIII
How to debug plpgsql with pgAdminIII [root@localhost soft_bak]# git clone git://git.postgresql.org/g ...
- 配置文件App.config的使用以及Readonly与Const的对比
以前我们学习的时候都把连接数据库的连接字符串写在一个类中,因为我们的数据库都在自己电脑上.如果更换数据库地址,需要更改这个类,然后重新编译才可以连接到数据库.现在我们需要将连接字符串当道一个文件中,然 ...
- BZOJ K大数查询(分治)(Zjoi2013)
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3110 Description 有N个位置,M个操作.操作有两种,每次操作如果是1 a b ...
- Socket get http request
package wuyubao.firstsample; import java.io.BufferedReader; import java.io.IOException; import java. ...
- mybatis(二)执行CRUD操作的两种方式配置和注解
一.使用MyBatis对表执行CRUD操作——基于XML的实现 1.定义sql映射xml文件 userMapper.xml文件的内容如下: <?xml version="1.0&quo ...
- JetBrains WebStorm 8 注册码
UserName:William===== LICENSE BEGIN =====45550-1204201000001SzFN0n1bPII7FnAxnt0DDOPJAINauvJkeVJBuE5b ...
- php获取网页中图片并保存到本地
php获取网页中图片并保存到本地的代码,将网页中图片保存本地文件夹: save_img("http://www.jbxue.com" ?>
- 2.js基础
4.函数 1)函数是一段完成“指定功能”的已经“命名”的代码段 2)函数只有“调用”才能使用到,调用就是通过名称(可以在声明之前,也可以在声明之后) 3)函数名.参数.函数体.返回值(没有返回值的函数 ...