简单几何(极角排序) POJ 2007 Scrambled Polygon

 

题目传送门

题意:裸的对原点的极角排序,凸包貌似不行。

 

/************************************************
* Author        :Running_Time
* Created Time  :2015/11/3 星期二 14:46:47
* File Name     :POJ_2007.cpp************************************************/#include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <cstdlib>
#include <ctime>
using namespace std;#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
typedef long long ll;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos (-1.0);
int dcmp(double x)  {if (fabs (x) < EPS) return 0;else    return x < 0 ? -1 : 1;
}
struct Point   {double x, y;Point ()    {}Point (double x, double y) : x (x), y (y) {}Point operator - (const Point &r) const {       //向量减法return Point (x - r.x, y - r.y);}bool operator == (const Point &r) const {       //判断同一个点return dcmp (x - r.x) == 0 && dcmp (y - r.y) == 0;}bool operator < (const Point &r) const  {return x < r.x || (dcmp (x - r.x) == 0 && y < r.y);}
};
typedef Point Vector;
Point read_point(void)  {double x, y;scanf ("%lf%lf", &x, &y);return Point (x, y);
}
double polar_angle(Vector A)    {return atan2 (A.y, A.x);
}
double dot(Vector A, Vector B)  {return A.x * B.x + A.y * B.y;
}
double cross(Vector A, Vector B)    {return A.x * B.y - A.y * B.x;
}bool cmp(Point a, Point b)  {return cross (a - Point (0, 0), b - Point (0, 0)) > 0;
}int main(void)    {vector<Point> ps;double x, y;while (scanf ("%lf%lf", &x, &y) == 2)   {ps.push_back (Point (x, y));}sort (ps.begin ()+1, ps.end (), cmp);for (int i=0; i<ps.size (); ++i)    {printf ("(%.0f,%.0f)\n", ps[i].x, ps[i].y);}//cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";return 0;
}

  

转载于:https://www.cnblogs.com/Running-Time/p/4935443.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/471448.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python 操作MySQL数据库

文章目录1. 安装 PyMySQL2. 连接对象3. 游标对象4. 增删改操作cursor.execute(sql)cursor.executemany(sql, seq_of_params)5. 查询操作6. ORM编程常用 python ORM 库learning from 《python web开发从入门到精通》 1. 安装 PyMySQL conda 虚拟环境下安装 pip install pymysq…

go oracle编程,go基础编程(一):第一个go程序-hello word

环境搭建环境搭建是在deepin操作系统上进行1. 下载go安装程序wget https://golang.org/dl/go1.16.linux-amd64.tar.gz以上是下载go1.16的版本&#xff0c;如需其他版本&#xff0c;请移步官网下载。2. 解压程序包到指定目录tar-C/usr/local-xzf go1.16.linux-amd64.tar.gz3. 添…

反射,System.Type类

http://m.blog.csdn.net/blog/woddle/40623333 两个现实中的例子&#xff1a;1、B超&#xff1a;大家体检的时候大概都做过B超吧&#xff0c;B超可以透过肚皮探测到你内脏的生理情况。这是如何做到的呢&#xff1f;B超是B型超声波&#xff0c;它可以透过肚皮通过向你体内发射B型…

python web框架基础

文章目录1. Web框架简介1.1 MVC1.2 模板引擎2. 常用 Python Web 框架3. 虚拟环境4. 部署方式learning from 《python web开发从入门到精通》 1. Web框架简介 简化 web 开发的软件框架 一般都支持&#xff1a;管理路由&#xff0c;支持数据库&#xff0c;MVC&#xff0c;ORM&…

导Excel数据到Oracle的脚本,Oracle使用TOAD实现导入导出Excel数据

在Oracle应用程序的开发过程中&#xff0c;访问数据库对象和编写SQL程序是一件乏味且耗费时间的工作&#xff0c;对数据库进行日常管理也是需要很多SQL脚本才能完成的。Quest Software为此提供了高效的Oracle应用开发工具-Toad。在Toad的新版本中&#xff0c;还加入了DBA模块&a…

Chapter 14 Exercises Problems

转载于:https://www.cnblogs.com/momoko/p/4937730.html

FastAPI 结合 SQLAlchemy 操作 MySQL 数据库

文章目录1. 安装 SQLAlchemy2. 创建数据库3. SQLAlchemy 连接 MySQL4. 创建数据模型5. 创建 Pydantic 模型6. crud 工具7. main函数learning from 《python web开发从入门到精通》 1. 安装 SQLAlchemy pip install sqlalchemy 2. 创建数据库 mysql -u root -p 命令行登录 M…

oracle 打开 ctl,Oracle 19c 随系统systemctl启动数据库

Oracle 19c 随系统systemctl启动数据库一、 修改oratab文件[rootadg19c ~]# grep woo /etc/oratabwoo:/DBSoft/oracle/product/19.3/dbhome_1:N[rootadg19c ~]# sed -i s/:N/:Y/ /etc/oratab[rootadg19c ~]# grep woo /etc/oratabwoo:/DBSoft/oracle/product/19.3/dbhome_1:Y二…

调用exe文件(一般处理登陆安全窗口)+睡眠等待(--------------------)

在测试basic认证的时候&#xff0c;处理windows弹窗的问题时&#xff0c;是用autoit进行处理的&#xff0c;最终转成一个.exe文件&#xff0c;然后再用java调用该exe文件。 1、调用自己打包的exe文件&#xff08;如下下例子&#xff09; package com.gmsd.gommon; import java.…

LeetCode 2094. 找出 3 位偶数

文章目录1. 题目2. 解题1. 题目 给你一个整数数组 digits &#xff0c;其中每个元素是一个数字&#xff08;0 - 9&#xff09;。数组中可能存在重复元素。 你需要找出 所有 满足下述条件且 互不相同 的整数&#xff1a; 该整数由 digits 中的三个元素按 任意 顺序 依次连接 …

oracle追踪触发器语句,Oracle中怎样通过触发器来追踪用户的活动?

从Oracle8i开始&#xff0c;Oracle引入了特殊的触发器&#xff0c;这些触发器并不是和特殊的DML事件相关联的(DML事件&#xff0c;如&#xff0c;INSERT,UPDATE和DELETE)。这些系统级别的触发器包括数据库启动触发器&#xff0c;DDL触发器和最终用户登陆/注销触发器。当Oracle提…

TotoiseSVN 使用参考文章

SVN使用教程总结 http://www.cnblogs.com/armyfai/p/3985660.html TotoiseSVN的基本使用方法 http://www.cnblogs.com/xilentz/archive/2010/05/06/1728945.html windows svn server and client and plugin的下载地址 https://www.visualsvn.com/downloads/ VisualSVN Server |…

oracle oci.dll的作用,ASP.NET bin目录中的Oracle oci.dll无法删除/不起作用

我按照这里的指示&#xff1a;http://splinter.com.au/blog/?p156尝试使用较新版本的ODP.NET而不安装Oracle 11g客户端.到目前为止,除了重启IIS之外,我都遵循了一切.然而,这引起了一些问题,我真的很好奇为什么.如果我尝试使用ODP.NET,我遇到了Oracle连接尝试连接时抛出的空白异…

POJ 3041 Asteroids (对偶性,二分图匹配)

题目&#xff1a;POJ 3041 Asteroids http://poj.org/problem?id3041 分析&#xff1a; 把位置下标看出一条边&#xff0c;这显然是一个二分图最小顶点覆盖的问题&#xff0c;Hungary就好。 挑战&#xff1a; 输出一组可行解。构造&#xff0c;已知二分图的两个点集U和V&#…

LeetCode 2095. 删除链表的中间节点(快慢指针)

文章目录1. 题目2. 解题1. 题目 给你一个链表的头节点 head 。删除 链表的 中间节点 &#xff0c;并返回修改后的链表的头节点 head 。 长度为 n 链表的中间节点是从头数起第 ⌊n / 2⌋ 个节点&#xff08;下标从 0 开始&#xff09;&#xff0c;其中 ⌊x⌋ 表示小于或等于 x…

linux 普通用户间切换,Linux中管理员用户与普通用户之间的切换

jsp页面添加一个集合数组到action(用序列化提交)页面的js //点击a标签增加删除 var i0; $("#a").on("click",function(){ var $newtr $("& ...JS 随机数function GetRandomNum(Min,Max){ var Range Max - Min; var Rand Math.random(); return…

sql 函数 总结

聚合函数 Avg(numeric_expr&#xff09;返回integer、decimal、money、float---返回组中各值的平均值 Count(*|column_name|distinct column_name) 返回integer---返回表中的记录数|返回指定列的数目|返回指定列的不同值的数目 Count_big(*|column_name|distinct column_name…

LeetCode 2096. 从二叉树一个节点到另一个节点每一步的方向(最小公共祖先)

文章目录1. 题目2. 解题1. 题目 给你一棵 二叉树 的根节点 root &#xff0c;这棵二叉树总共有 n 个节点。 每个节点的值为 1 到 n 中的一个整数&#xff0c;且互不相同。 给你一个整数 startValue &#xff0c;表示起点节点 s 的值&#xff0c;和另一个不同的整数 destValue …

linux下实现内存监视,shell脚本来监视Linux上的内存使用情况

shell脚本来监视Linux上的内存使用情况监视所有内容&#xff0c;例如CPU利用率&#xff0c;内存利用率&#xff0c;交换利用率&#xff0c;磁盘空间利用率等等。如果您只有很少的系统并且要监视它们&#xff0c;那么编写一个小的Shell脚本可以使您的任务非常容易。我们添加了两…

大数据的学习历程

大数据scala语言不仅可以在函数中嵌套函数&#xff0c;还可以定义偏函数。 def sum(a :Int,b:Int,c:Int) abcval pld sum _println(pld(1,2,3))println(pld.apply(1, 2, 3))val ped sum(1,_:Int,3)println(ped(2))println(ped.apply(2))val add (x : Int)> x2println(ad…