首页 > 代码库 > HDU 2134
HDU 2134
Cuts the cake
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2740 Accepted Submission(s): 1739
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
10 15 5 25 0
Sample Output
5.774 8.165 8.660 12.247 2.887 4.082 14.434 20.412
Author
☆RPG♀月野兔☆
Source
HDU 2007-11 Programming Contest_WarmUp
Recommend
威士忌
题意,给你大R的长度,让你求两个小r多长。水题,用大R求出总面积。面积分成三份,r1对应的占三分之二。r2占三分之一。然后算出即可。
超级水。
#include <stdio.h> #define PI 3.1415926 #include<math.h> int main() { double a,r1,r2; while(scanf("%lf",&a)&&a) { double s=a*a*PI; double r1=sqrt(2.0/3.0*s/PI); double r2=sqrt(s/3.0/PI); printf("%.3lf %.3lf\n",r2,r1); } return 0; }
HDU 2134
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。