poj 2007 Scrambled Polygon
#include<stdio.h>
#include<algorithm>
using namespace std;
#define Max 60
struct Point
{
int x,y;
} p[Max];
int xmult(Point p1,Point p2,Point p0)
{
return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
int pos;
bool cmp(Point p1,Point p2)
{
if(xmult(p1,p2,p[pos])>)
return true;
return false;
}
int main()
{
int i,n=;
while(scanf("%d%d",&p[n].x,&p[n].y)!=EOF)
{
n++;
//if(n==6)break;
}
for(i=; i<n; i++)
{
pos=i-;
sort(p+i,p+n,cmp);
}
for(i=; i<n; i++)
printf("(%d,%d)\n",p[i].x,p[i].y);
return ;
}
poj 2007 Scrambled Polygon的更多相关文章
- POJ 2007 Scrambled Polygon 凸包
Scrambled Polygon Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7214 Accepted: 3445 ...
- POJ 2007 Scrambled Polygon [凸包 极角排序]
Scrambled Polygon Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 8636 Accepted: 4105 ...
- POJ 2007 Scrambled Polygon 极角序 水
LINK 题意:给出一个简单多边形,按极角序输出其坐标. 思路:水题.对任意两点求叉积正负判断相对位置,为0则按长度排序 /** @Date : 2017-07-13 16:46:17 * @File ...
- poj 2007 Scrambled Polygon(极角排序)
http://poj.org/problem?id=2007 Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6701 A ...
- ●POJ 2007 Scrambled Polygon
题链: http://poj.org/problem?id=2007 题解: 计算几何,极角排序 按样例来说,应该就是要把凸包上的i点按 第三像限-第四像限-第一像限-第二像限 的顺序输出. 按 叉积 ...
- 简单几何(极角排序) POJ 2007 Scrambled Polygon
题目传送门 题意:裸的对原点的极角排序,凸包貌似不行. /************************************************ * Author :Running_Time ...
- POJ 2007 Scrambled Polygon (简单极角排序)
题目链接 题意 : 对输入的点极角排序 思路 : 极角排序方法 #include <iostream> #include <cmath> #include <stdio. ...
- poj 2007 Scrambled Polygon 极角排序
/** 极角排序输出,,, 主要atan2(y,x) 容易失精度,,用 bool cmp(point a,point b){ 5 if(cross(a-tmp,b-tmp)>0) 6 retur ...
- POJ 2007 Scrambled Polygon 凸包点排序逆时针输出
题意:如题 用Graham,直接就能得到逆时针的凸包,找到原点输出就行了,赤果果的水题- 代码: /* * Author: illuz <iilluzen[at]gmail.com> * ...
随机推荐
- FC Switch sfpshow
sfpshow - fault-finding on Brocade Fibre Channel Switches So you've hit a situation where a Fibre Ch ...
- .NET System.Web.HttpContext.Current.Request报索引超出数组界限。
移动端使用Dio发送 FormData, 请求类型 multipart/form-data, FormData内可以一个或多个包含文件时. 请求接口时获取上传的fomdata数据使用 System.W ...
- 6 istio 配置 grafana
1 验证prometheus service 已经运行: $ kubectl -n istio-system get svc prometheus NAME CLUSTER-IP EXTERNAL- ...
- MetaboAnalysis KEGG match methods
1.KEGG regexdb.idmap.find({"name":{"$regex":"Prolyl-hydroxyproline",&q ...
- django-bower
https://django-bower.readthedocs.io/en/latest/usage.html
- Tkinter Fonts(字体)
Python GUI - Tkinter Fonts:作为一个tuple的第一个元素是字体家族,一个点的大小,可选择一个字符串,包含一个或更多的粗体,斜体,下划线的样式修饰符,加粗. 最多可能有三 ...
- Android MVP模式简单易懂的介绍方式 (三)
Android MVP模式简单易懂的介绍方式 (一) Android MVP模式简单易懂的介绍方式 (二) Android MVP模式简单易懂的介绍方式 (三) 讲完M和P,接下来就要讲V了.View ...
- Python中的列表生成式和多层表达式
Python中的列表生成式和多层表达式 如何生成[1x1, 2x2, 3x3, ..., 10x10]的列表? L=[]; ,): L.append(x*x) print L print (" ...
- Android的SearchView详解
转自https://www.jianshu.com/p/7c1e78e91506 一.简述 SearchView是v7包中的一个兼容性控件,它可以单独使用,也可以配合menu+toolbar一起使用. ...
- mybatis mysql 批量insert 返回主键
Mybatis在插入单条数据的时候有两种方式返回自增主键: mybatis3.3.1支持批量插入后返回主键ID, 首先对于支持自增主键的数据库:useGenerateKeys和keyProper ...