Cuts the cake +面积相等
来源:互联网 发布:android开发网络框架 编辑:程序博客网 时间:2024/05/29 09:11
Cuts the cake
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1964 Accepted Submission(s): 1210
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.
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
10155250
Sample Output
5.774 8.1658.660 12.2472.887 4.08214.434 20.412
Author
☆RPG♀月野兔☆
Source
HDU 2007-11 Programming Contest_WarmUp
思路:由面积相等,可得r1,r2的计算公式
r1=(sqrt(3)*R)/3
r2=sqrt(R*R-r2*r2)
思路:由面积相等,可得r1,r2的计算公式
r1=(sqrt(3)*R)/3
r2=sqrt(R*R-r2*r2)
#include<iostream>#include<iomanip>#include<cmath>using namespace std;int main(){double R;while(cin>>R&&R){double r2=(sqrt(3)*R)/3;double r1=sqrt(R*R-r2*r2);cout<<fixed<<setprecision(3)<<r2<<" "<<fixed<<setprecision(3)<<r1<<endl;}return 0;}
- Cuts the cake +面积相等
- ACM--圆面积--HDOJ 2134--Cuts the cake
- hoj2134 Cuts the cake
- HDU2134:Cuts the cake
- Cuts the cake
- hdu-2134-Cuts the cake
- hd 2134 Cuts the cake
- hdoj 2134 Cuts the cake
- HDU 2134 Cuts the cake
- 杭电2134-Cuts the cake
- HDU-2134 Cuts the cake 水题 数学题
- 【HDU 2134】【水题】Cuts the cake
- Hust oj 1197 Cuts the cake(水题)
- Cuts the cake_hdu_2134.java
- This Takes the Cake 恶心的面积剖分 不过是水题
- zoj 1806 This Takes the Cake 计算凸四边形和三角形的面积
- CUDA Cuts: Fast Graph Cuts on the GPU
- CUDA Cuts: Fast Graph Cuts on the GPU
- 家用路由器-- LAN与WAN通信的过程以及IP转换
- oracle 11g 修改server端的字符编码
- ADO访问数据库
- mysql的复习
- HDU 4445 Crazy Tank
- Cuts the cake +面积相等
- ACM图灵奖的现状,最新一届的图灵奖得主和他们的贡献
- select的用法
- u-boot中的bdinfo命令
- Hadoop集群(第10期)_MySQL关系数据库
- activity跳转后关闭父activity
- 整合Hibernate3.3和struts2.3.8的小例子
- 性能优化总结
- Myeclipse中Swing插件的使用