HDU 4798 Skycity【计算机几何】【阅读题】

Skycity

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 657    Accepted Submission(s): 235


Problem Description
The world's new tallest building is going to be built in Changsha, which will be called as "Skycity". The Skycity is going to be built as a circular truncated cone, radius of its bottom is marked as R, and radius of its top is marked as r, height of the building is marked as H, and there will be F floors with exact the same height in the whole building.
After construction of the building's skeleton, the construction team is going to construct the curtain wall using thousands of glass panes. The curtain wall is installed in each floor. When installing the curtain wall in a floor, first the construction team will measure the radius r' of the ceiling, then they will install the glass curtain wall as a regular prism which can exactly contain the ceiling circle. When constructing the glass curtain wall, all the glass pane has a minimum area requirement S, and amount of glass usage should be as little as possible.

As all the glass has exact the same thickness, so we can calculate the consumption of each glass pane as its area. Could you calculate the minimum total glass consumption?
 

Input
There will be multiple test cases. In each test case, there will be 5 integers R, r (10 ≤ r < R ≤ 10000), H (100 ≤ H ≤ 10000), F (10 ≤ F ≤ 1000) and S (1 ≤ S <× r × H ÷ F) in one line.
 

Output
For each test case, please output the minimum total glass consumption, an absolute error not more than 1e-3 is acceptable.
 

Sample Input
50 10 800 120 5 300 50 2000 500 10
 

Sample Output
149968.308 2196020.459


给出一个圆台,给出底部半径R和顶部半径r,圆台高度为H,把圆台分成F份登高的小圆台,按每个圆台顶部的圆为标准,用多边形(推得必须是正多边形来保证相切)来围住这些圆,这些多边形都是垂直的帘子,并且给出每个帘子的最小面积S,所以有它们的面积,它们的面积就是它们的耗费。问要求的最小耗费是多少。

思路:所求多边形周长为,θ是多边形一个端点和圆心的连线与圆心和这条边中点连线的夹角。θ越大消耗越大,即边数越少,消耗越大。

对于每层,根据最小面积S得到最小边长x,得到可以得到的多边形的边数的最大值,然后算出周长即可。

#include<iostream>	
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<numeric>
#include<vector>
#include<string>
#include<iterator>
#include<cstring>
#include<functional>
#define INF 0x3f3f3f3f
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;

const int maxn = 55;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);

typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

double R, r, H, F, S;
double cal(double r, double h)
{
	int n = pi / atan(S / (2 * r*h));
	return 2 * r*n*tan(pi / n);
}

int main()
{
	while (~scanf("%lf%lf%lf%lf%lf", &R, &r, &H, &F, &S))
	{
		double h = H / F;
		double ans = 0;
		ans += cal(r, h)*h;
		for (int i = 1; i <= F - 1; i++)
		{
			double x = (R - r)*i / F + r;
			ans += cal(x, h)*h;
		}
		printf("%.3f
", ans);
	}
}



Fighting~
原文地址:https://www.cnblogs.com/Archger/p/12774762.html