http://acm.hdu.edu.cn/showproblem.php?pid=2134

Problem Description
Ice cream took a bronze medal in the Beijing match. Liu sir is very very happy. So he buys a cake for them. kiki is a child who likes eating, so the task of cuting cake was given to kiki. kiki is also a mischievous child. She wants to cut the cake in a different way. This is introduced in the figure below.

But there is a difficult problem.which is how to make each preson get equally many cake. kiki is not good at match, so she wants you help her solve this problem. 
 
Input
Input contains multiple test cases. Each line is a case. Each case contains only one integer R which is the radius. The input is terminated with a R of 0.
 
Output
For each test case, you should printf two numbers r2 and r1 in a line, accurate up to 3 decimal places, separate them by one space.
 
Sample Input
10
15
5
25
0
 
Sample Output
5.774 8.165
8.660 12.247
2.887 4.082
14.434 20.412
 
代码:

#include <bits/stdc++.h>
using namespace std; int main() {
double R;
while(cin >> R) {
if(R == 0)
break; double r1, r2;
r1 = sqrt(R * R / 3.0);
r2 = sqrt(R * R * 2.0 / 3.0); printf("%.3lf %.3lf\n", r1, r2);
}
return 0;
}

  

HDU 2134 Cuts the cake的更多相关文章

  1. hdu 4454 Stealing a Cake(三分之二)

    pid=4454" target="_blank" style="">题目链接:hdu 4454 Stealing a Cake 题目大意:给定 ...

  2. HDU 5640 King's Cake GCD

    King's Cake 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5640 Description It is the king's birthd ...

  3. HDU 4762 Cut the Cake(公式)

    Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  4. HDU 5640 King's Cake

    King's Cake Problem Description It is the king's birthday before the military parade . The ministers ...

  5. hdu 5640 King's Cake(BestCoder Round #75)

    King's Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  6. HDU 4762 Cut the Cake

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋 ...

  7. hdu 4762 Cut the Cake概率公式

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:一个圆形蛋糕,现在要分成M个相同的扇形,有n个草莓,求n个草莓都在同一个扇形上的概率. ...

  8. hdu 5640 King's Cake(模拟)

    Problem Description   It is the king's birthday before the military parade . The ministers prepared ...

  9. hdu 4454 Stealing a Cake (三分)

    Stealing a Cake Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

随机推荐

  1. 20155332 补交课后测试——ch11网络编程

    20155332 补交课后测试--ch11网络编程 这章的课后测试忘了提交,我课后补做了这章的测试题目,并将知识点和自己的错题汇总如下: 本章知识点总结 11.1 客户端-- 服务器模型 每个网络应用 ...

  2. 用C实现单隐层神经网络的训练和预测(手写BP算法)

    实验要求:•实现10以内的非负双精度浮点数加法,例如输入4.99和5.70,能够预测输出为10.69•使用Gprof测试代码热度 代码框架•随机初始化1000对数值在0~10之间的浮点数,保存在二维数 ...

  3. 【CJOJ2433】陌上花开 CDQ分治

    [CJOJ2433]陌上花开 CDQ呲嘚秋分治 WA果然呲嘚秋分治跑得比树套树还快!!!(md理论复杂度不是一样的吗) 但树套树不知道比呲嘚秋高到哪里去辣装X用 Orz hzwer 第一维sort,第 ...

  4. 使用Keil下载单独的Hex文件到单片机内

    前言 初学STM32时,是通过串口1把Hex文件下载进STM32的,需要一个串口模块,而且还要设置BOOT0和BOOT1电平,然后通过FlyMcu软件进行下载,这也是一种不错的方法,这里我要介绍的是使 ...

  5. java 循环中使用list时,出现list中全部加入了对象导致没有实现分组的解决方案

    清空list即可 public List fetchNmapSingleTaskWithDataList() { Map map = new HashMap<>(); List listN ...

  6. [TJOI2013]拯救小矮人[排序+dp]

    题意 题目链接 分析 Imagine的完美回答 重点大概是证明我们选出要救的小矮人一定可以根据 \(a_i+b_i\) 的大小进行排序救出. 注意这里关注的对象是可以保留的高度,所以我们的dp值才会表 ...

  7. python自动化17-JS处理滚动条

    前言 selenium并不是万能的,有时候页面上操作无法实现的,这时候就需要借助JS来完成了. 常见场景: 当页面上的元素超过一屏后,想操作屏幕下方的元素,是不能直接定位到,会报元素不可见的. 这时候 ...

  8. react-native初体验(1) — hello world

    没有简介,直接开始干活吧. 默认阅读本文的你已经安装好 nodejs, windows用户需要升级yarn到最新版本. 并且设置安装源为国内的淘宝源: npm config set registry ...

  9. 六、Django之表单和类视图-Part 4

    一.表单form 为了接收用户的投票选择,我们需要在前端页面显示一个投票界面.让我们重写先前的polls/detail.html文件,代码如下: <h1>{{ question.quest ...

  10. Andorid Studio 模块化开发相关配置

    Andorid Studio 模块化开发相关配置 下面以宿主APP模块和Uer_Module模块为例: 第一步:在项目根目录gradle.properties配置文件中添加如下代码 isNeedUse ...