hdu 2352 Max Angle 极角排序

游戏开发技术深入解析
本文详细探讨了游戏开发领域的核心技术,包括游戏引擎、动画、3D空间视频等关键概念及应用,为游戏开发者提供深入的技术指导。

Max Angle

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 342    Accepted Submission(s): 128

Problem Description
Given many points in a plane, two players are playing an interesting game.

Player1 selects one point A as the vertex of an angle. Then player2 selects other two points B and C. A, B and C are different with each other. Now they get an angle B-A-C.

Player1 wants to make the angle as large as possible, while player2 wants to make the angle as small as possible.

Now you are supposed to find the max angle player1 can get, assuming play2 is c lever enough.
 

 

Input
There are many test cases. In each test case, the first line is an integer n (3 <= n <= 1001), which is the number of points on the plane. Then there are n lines. Each contains two floating number x, y, witch is the coordinate of one point. n <= 0 denotes the end of input.
 

 

Output
For each test case, output just one line, containing the max angle player1 can get in degree format. The result should be accurated up to 4 demicals.
 

 

Sample Input
3 0 0 2 0 0 5 -1
 

 

Sample Output
90.0000
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const double pi=acos(-1+0.0);//0.0  important
struct node
{
    double x,y;
};
double dis(node a, node b)
{
     return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
int main()
{
    int n;
    node a[1100];
    double t[1100];
    while(scanf("%d",&n)==1&&n>0)
    {
        for(int i=0;i<n;i++) scanf("%lf%lf",&a[i].x,&a[i].y);
        double cnt=0;
        for(int i=0;i<n;i++)//枚举顶点  important
        {
            int l=0;//极角排序,排的是各点到顶点的角度(相对x轴),在顶点下面的点要用2*pi-angle
            for(int j=0;j<n;j++)
            {
                if(i==j) continue;
                t[l++]=acos((a[j].x-a[i].x)/dis(a[i],a[j]));//用acos important
                if(a[j].y<a[i].y) t[l-1]=2*pi-t[l-1];//考虑在点下方 important
            }
            sort(t,t+l);
            double _min=2*pi-t[l-1]+t[0];//第一个点和最后一个点之间的夹角  important
            for(int i=1;i<l;i++) if(t[i]-t[i-1]<_min) _min=t[i]-t[i-1];//找相邻的夹角  important
            if(_min>cnt) cnt=_min;
        }
        printf("%.4lf/n",cnt*180/pi);
    }
    return 0;
}
分布式微服务企业级系统是一个基于Spring、SpringMVC、MyBatis和Dubbo等技术的分布式敏捷开发系统架构。该系统采用微服务架构和模块化设计,提供整套公共微服务模块,包括集中权限管理(支持单点登录)、内容管理、支付中心、用户管理(支持第三方登录)、微信平台、存储系统、配置中心、日志分析、任务和通知等功能。系统支持服务治理、监控和追踪,确保高可用性和可扩展性,适用于中小型企业的J2EE企业级开发解决方案。 该系统使用Java作为主要编程语言,结合Spring框架实现依赖注入和事务管理,SpringMVC处理Web请求,MyBatis进行数据持久化操作,Dubbo实现分布式服务调用。架构模式包括微服务架构、分布式系统架构和模块化架构,设计模式应用了单例模式、工厂模式和观察者模式,以提高代码复用性和系统稳定性。 应用场景广泛,可用于企业信息化管理、电子商务平台、社交应用开发等领域,帮助开发者快速构建高效、安全的分布式系统。本资源包含完整的源码和详细论文,适合计算机科学或软件工程专业的毕业设计参考,提供实践案例和技术文档,助力学生和开发者深入理解微服务架构和分布式系统实现。 【版权说明】源码来源于网络,遵循原项目开源协议。付费内容为本人原创论文,包含技术分析和实现思路。仅供学习交流使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值