This time your job is to calculate the volume of a special object. The object consists of two orthogonal cylinders. The two cylinders intersect each other in the middle place. One example is shown in Fig. 1. The radiuses of the bottom disk of both cylinders are R, and the heights of both cylinders are H.

Fig.1 Two orthogonal cylinders

Input

We test the problem in many cases. Each case includes two integers, the first one is R and the second one is H. All the numbers given are positive integers and are less than 100.

Output

The output consists of the volumes. The results must be round to 4 decimal numbers. Remember that R may be less than half of H.

Sample Input

10 30
10 40

Sample Output

13516.2226
19799.4079 注意有2个情况分别是2*R大于小于H;
2*R<H时就是直接的牟和方盖
2*R>H图形就要自己画一个。自己画出来就是感觉 是一个长方体+牟合方盖 积分区间有变化
两个圆弧面相交就会形成那个方盖图形样。之前这个圆弧面相交就简单的想象成一个圆柱的简单弧面那个样子。
积分牟合方盖可以百度
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
int main()
{
double r,h,ans,v;
while (cin >> r >> h)
{
v = 2 * r * r * PI * h;
if (r * 2 > h)
{
double temp = sqrt(r * r - h * h / 4);
ans = temp * h * h / 4 + r * r * r * 2 / 3 - r * r * temp + temp * temp * temp / 3;
}
else
ans = r * r * r * 2 / 3;
printf("%.4lf\n",v - ans * 8);
}
return 0;
}

  


UVALIVE 5096 Volume的更多相关文章

  1. Java中实现SAX解析xml文件到MySQL数据库

    大致步骤: 1.Java bean 2.DBHelper.java 3.重写DefaultHandler中的方法:MyHander.java 4.循环写数据库:SAXParserDemo.java ① ...

  2. CSharpGL(8)使用3D纹理渲染体数据 (Volume Rendering) 初探

    CSharpGL(8)使用3D纹理渲染体数据 (Volume Rendering) 初探 2016-08-13 由于CSharpGL一直在更新,现在这个教程已经不适用最新的代码了.CSharpGL源码 ...

  3. 理解Docker(8):Docker 存储之卷(Volume)

    (1)Docker 安装及基本用法 (2)Docker 镜像 (3)Docker 容器的隔离性 - 使用 Linux namespace 隔离容器的运行环境 (4)Docker 容器的隔离性 - 使用 ...

  4. Docker Volume 之权限管理(转)

    Volume数据卷是Docker的一个重要概念.数据卷是可供一个或多个容器使用的特殊目录,可以为容器应用存储提供有价值的特性: 持久化数据与容器的生命周期解耦:在容器删除之后数据卷中的内容可以保持.D ...

  5. NFS Volume Provider(Part III) - 每天5分钟玩转 OpenStack(64)

    今天我们将前一小节创建的 NFS volume “nfs-vol-1” attach 到 instance “c2”上. 这里我们重点关注 nova-compute 如何将“nfs-vol-1” at ...

  6. NFS Volume Provider(Part II) - 每天5分钟玩转 OpenStack(63)

    上一节我们将 NFS volume provider 配置就绪,本节将创建 volume. 创建 volume 创建 NFS volume 操作方法与 LVM volume 一样,唯一区别是在 vol ...

  7. NFS Volume Provider(Part I) - 每天5分钟玩转 OpenStack(62)

    cinder-volume 支持多种 volume provider,前面我们一直使用的是默认的 LVM,本节我们将增加 NFS volume provider. 虽然 NFS 更多地应用在实验或小规 ...

  8. Boot from Volume - 每天5分钟玩转 OpenStack(61)

    Volume 除了可以用作 instance 的数据盘,也可以作为启动盘(Bootable Volume),那么如何使 volume 成为 bootable 呢? 现在我们打开 instance 的 ...

  9. Restore Volume 操作 - 每天5分钟玩转 OpenStack(60)

    前面我们 backup 了 voluem,今天我们将讨论如何 restore volume. restore 的过程其实很简单,两步走: 在存储节点上创建一个空白 volume. 将 backup 的 ...

随机推荐

  1. fiddler抓包-简单易操作(一)

    1.下载fiddler 可以到fiddler官网去下,网址:https://www.telerik.com/download/fiddler 下载完成后,安装即可. 2.运行fiddler,进入fid ...

  2. 关于redis一些问题记录

    问题一:启动redis时出现警告,使用下列命令(已解决) 问题二:启动时,需要解决的警告(未解决) 问题三:使用自己的配置文件启动redis时,可能会遇到: Could not connect to ...

  3. DCGAN: "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Network" Notes

    - Alec Radford, ICLR2016 原文:https://arxiv.org/abs/1511.06434 论文翻译:https://www.cnblogs.com/lyrichu/p/ ...

  4. 解决:Unable to execute dex: GC overhead limit exceeded

    转自http://blog.sina.com.cn/s/blog_6e334dc70101hnug.html Android打包时下面的错误: Unable to execute dex: GC ov ...

  5. django类视图简单使用和源码解析

    django的类视图,CBV: 我们在开始接触django的时候,习惯于使用函数编写视图,即FBV.使用FBV时,我们只需要在路由匹配时,对应的路由下找到这个函数就可以了,这样做看似很和谐,但是有的时 ...

  6. NO5——素数筛选

    #include <stdio.h> int main() { ]={}; ;i<=;i++) a[i]=; ;i<=;i++) if(a[i]) ;j+=i) a[j]=; ...

  7. lintcode-117-跳跃游戏 II

    117-跳跃游戏 II 给出一个非负整数数组,你最初定位在数组的第一个位置. 数组中的每个元素代表你在那个位置可以跳跃的最大长度. 你的目标是使用最少的跳跃次数到达数组的最后一个位置. 样例 给出数组 ...

  8. log4j的常用使用方法

    第一步,引入jar包,不做介绍. 第二步,创建以下类(固定写法) package smn.util; import org.apache.log4j.Logger; public class MyLo ...

  9. JavaScript实现键盘操作页面跳转

    对于使用笔记本的同学来说,鼠标操作比较费劲,键盘操作比较方便,下面是一段JavaScript写的,用键盘来实现页面跳转.把location后面的改成你要跳转的地址即可,示例是用方向键实现日志页面的前一 ...

  10. LeetCode--Factorial Trailing Zeroes(注意)

    Given an integer n, return the number of trailing zeroes in n!. 问题描述:给出一个正整数n,计算n!结构后面有几个0.要求:在多项式时间 ...