UVALive 6618 Skycity(数学)

本文介绍了一种计算与给定圆相切的正多边形周长的方法,通过设定边长的最小限制来确定正多边形的边数,并提供了一个具体的实现示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

思路:一开始写二分边数一直WA到无法自理...对于给定的圆,和他相切的正多边形的边数越多,正多边形的周长越小。但是因为对每个边长有最小的长度限制,我们可以直接算出来。利用边长的最小限制,我们能求出对应的内角,从而可以找到大于等于该内角度数的边数最小的正多边形。(摘自网上)


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
double R , r , H , F , S;
const double pi = acos(-1.0);

int main()
{
    while (scanf("%lf%lf%lf%lf%lf",&R , &r , &H , &F , &S)!=EOF)
	{
        double ans = 0;
		double height = 1.0*H/F;
        double d = (R-r)/F;
		for(int i = 0;i<(int)F;i++)
		{
			double dr = r+i*d;
			int bianshu = pi/atan(S/2.0/height/dr);
			ans+=bianshu*2.0*dr*tan(pi/bianshu)*height;
		}
		printf("%.3lf\n",ans);
	}
    return 0;
}


中文行程: |日期|行程安排|酒店住宿| |---|-------|-------| |7.12|晚11:45广州起飞|无| |7.13|14:45到奥克兰—入住酒店Skycity|Skycity| |7.13|下午酒店休息,晚上出门楼下吃饭逛街|Skycity| |7.14|前往霍比特村奥克兰一日游,回Skycity|Skycity| |7.15|游览Skycity和奥克兰市区|Skycity| |7.16|前往基督城 入住基督城酒店|基督城酒店| |7.16|基督城半日游,公园|基督城酒店| |7.17|基督城一日游,晚上住基督城|基督城酒店| |7.18|前往皇后镇,湖边游玩 ,入住里斯酒店|里斯酒店| |7.19|拍照游览山川|里斯酒店| |7.20|游览雪山|里斯酒店| |7.21|箭镇|里斯酒店| |7.22|皇后镇再游 ,入住里斯酒店|里斯酒店| |7.23|回奥克兰,逛顾城故居;入住Skycity,休息;楼下逛;|Skycity| |7.24|休闲游,晚上10点奥克兰飞回广州|无| 英文行程: |Date|Itinerary|Hotel Accommodation| |---|---------|-------------------| |7.12|Depart from Guangzhou at 11:45pm|None| |7.13|Arrive in Auckland at 2:45pm - Check in at Skycity Hotel|Skycity Hotel| |7.13|Rest at the hotel in the afternoon, dinner and shopping in the evening|Skycity Hotel| |7.14|One day trip to Hobbiton Village, return to Skycity Hotel|Skycity Hotel| |7.15|Visit Skycity and Auckland city|Skycity Hotel| |7.16|Travel to Christchurch - Check in at Christchurch Hotel|Christchurch Hotel| |7.16|Half-day tour and park visit in Christchurch|Christchurch Hotel| |7.17|One day tour in Christchurch, spend the night in Christchurch|Christchurch Hotel| |7.18|Travel to Queenstown, Lake visit and check in at The Rees Hotel|The Rees Hotel| |7.19|Photo tour of the mountains and scenery|The Rees Hotel| |7.20|Visit the Snowy Mountains|The Rees Hotel| |7.21|Visit Arrowtown|The Rees Hotel| |7.22|Return to Queenstown, further visit and spend the night at The Rees Hotel|The Rees Hotel| |7.23|Return to Auckland - Visit Gu Cheng residence, check in at Skycity Hotel, rest and explore downstairs|Skycity Hotel| |7.24|Leisure activities - Depart Auckland at 10pm for Guangzhou|None|
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值