ACM--steps--4.1.7--Dome of Circus(三分)
来源:互联网 发布:lte网络优化是做什么的 编辑:程序博客网 时间:2024/05/05 03:10
Dome of Circus
Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 471 Accepted Submission(s): 222Problem Description
A travelling circus faces a tough challenge in designing the dome for its performances. The circus has a number of shows that happen above the stage in the air under the dome. Various rigs, supports, and anchors must be installed over the stage, but under the dome. The dome itself must rise above the center of the stage and has a conical shape. The space under the dome must be air-conditioned, so the goal is to design the dome that contains minimal volume.
You are given a set of n points in the space; (xi, yi, zi) for 1 ≤ i ≤ n are the coordinates of the points in the air above the stage that must be covered by the dome. The ground is denoted by the plane z = 0, with positive z coordinates going up. The center of the stage is on the ground at the point (0, 0, 0).
The tip of the dome must be located at some point with coordinates (0, 0, h) with h > 0. The dome must have a conical shape that touches the ground at the circle with the center in the point (0, 0, 0) and with the radius of r. The dome must contain or touch all the n given points. The dome must have the minimal volume, given the above constraints.
You are given a set of n points in the space; (xi, yi, zi) for 1 ≤ i ≤ n are the coordinates of the points in the air above the stage that must be covered by the dome. The ground is denoted by the plane z = 0, with positive z coordinates going up. The center of the stage is on the ground at the point (0, 0, 0).
The tip of the dome must be located at some point with coordinates (0, 0, h) with h > 0. The dome must have a conical shape that touches the ground at the circle with the center in the point (0, 0, 0) and with the radius of r. The dome must contain or touch all the n given points. The dome must have the minimal volume, given the above constraints.
Input
The input begins with an integer T. The next T blocks each represents a case. The first line of each case contains a single integer number n (1 ≤ n ≤ 10 000) - the number of points under the dome. The following n lines describe points with three floating point numbers xi, yi, and zi per line - the coordinates of i-th point. All coordinates do not exceed 1000 by their absolute value and have at most 2 digits after decimal point. All zi are positive. There is at least one point with non-zero xi or yi.
Output
For each case , write to the output file a single line with two floating point numbers h and r - the height and the base radius of the dome. The numbers must be precise up to 3 digits after decimal point.
Sample Input
311.00 0.00 1.0021.00 0.00 1.000.00 1.50 0.5031.00 0.00 1.000.00 1.50 0.50-0.50 -0.50 1.00
Sample Output
3.000 1.5002.000 2.0002.000 2.000
Author
Georgiy Korneev
Source
2010 Northeastern European Regional Contest
Recommend
notonlysuccess
//用c++提交
#include<iostream>#include<cmath>#include<iomanip>using namespace std;double wyx[10009],dyx[10009];//wyx表示x轴的坐标,dyx表示z轴的坐标。int n;double fun(double h){ double r=0; for(int i=1;i<=n;i++) { //根据相似三角形推得。 //高越大,半径越小,反之一样。 if((h*wyx[i])/(h-dyx[i])>r) r=(h*wyx[i])/(h-dyx[i]); } return r;}int main(){ int T; cin>>T; while(T--) { cin>>n; double t,mid,mmid;//y轴的坐标。 double left,right,r1,r2; left=0; right=9999999; for(int i=1;i<=n;i++) { cin>>wyx[i]>>t>>dyx[i]; wyx[i]=sqrt(wyx[i]*wyx[i]+t*t); if(dyx[i]>left) left=dyx[i]; } while(fabs(left-right)>0.0000001) { mid=left+(right-left)/3; mmid=right-(right-left)/3; r1=fun(mid); r2=fun(mmid); if(r1*r1*mid>r2*r2*mmid) left=mid; else right=mmid; } cout<<fixed<<setprecision(3)<<left<<" "; cout<<fixed<<setprecision(3)<<fun(left)<<endl; } return 0;}
0 0
- ACM--steps--4.1.7--Dome of Circus(三分)
- Dome of Circus(三分)
- hdoj 3756 Dome of Circus(三分)
- HDU 3756 Dome of Circus (三分)
- 【三分】HDU3756 Dome of Circus
- hdu3756 Dome of Circus:三分学习
- HDU 3756 Dome of Circus 三分
- hdu 3756 三分 Dome of Circus
- hdu 3756 Dome of Circus 三分
- hdu 3756 Dome of Circus 三分
- HDU 3756 Dome of Circus 三分
- hdu 3756 || Dome of Circus || 2010 Northeastern European Regional Contest(三分)
- LA 4986 hdu3756 Dome of Circus 三分答案
- UVA 1473 - Dome of Circus(三分+计算几何)
- HDU 3756 Dome of Circus(计算几何 + 三分)
- UVa 1473 Dome of Circus(求凸包)
- HDU Dome of Circus
- LA4986 Dome of Circus
- LeetCode:Add Two Numbers
- 上海赞阁装饰工程有限公司
- android与javascript交互(Binding JavaScript code to Android code)
- vs2008编译Postgresql-9.3.5
- 让 Dreamweaver 支持 Emmet(原ZenCoding)
- ACM--steps--4.1.7--Dome of Circus(三分)
- 轮廓处理函数详细(转)
- Materialize - 响应式 Material Design 框架
- 上海严艺装饰设计有限公司
- 比微软kinect更强的视频跟踪算法--TLD跟踪算法介绍
- 由于SSH配置文件的不匹配,导致的Permission denied (publickey)及其解决方法
- aop代理-简单demo
- Python--ZOJ 1216、1240、1241、1242
- dbvisualizer不能执行pl/sql块