hdu 2108 Shape of HDU(判定是不是凸多边形)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <map>
#include <cmath>
#include <vector> #define Faster ios::sync_with_stdio(false),cin.tie(0)
#define Read freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define Close fclose(stdin),fclose(stdout)
const int maxn = 1e5 + ;
using namespace std;
const int MOD = 1e9+;
typedef long long ll; const double eps = 1e-;
#define _sign(x)((x)>eps?1:((x)<-eps?2:0)) struct point
{
double x,y;
}p[maxn]; double 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 is_convex(int n) {
int i,s[]={,,};
for (i=;i<n&&s[]|s[];i++)
s[_sign(xmult(p[(i+)%n],p[(i+)%n],p[i]))] = ;
return s[]|s[];
} int main(){
Faster;
int n;
while(cin >> n){
if(n == )
break;
for(int i = ;i < n;i++){
cin >> p[i].x >> p[i].y;
}
if(is_convex(n)){
cout << "convex" << endl;
}
else
cout << "concave" << endl;
}
return ;
}
hdu 2108 Shape of HDU(判定是不是凸多边形)的更多相关文章
- hdu 2108 Shape of HDU【判断多边形是否是凸多边形模板】
链接: http://acm.hdu.edu.cn/showproblem.php?pid=2108 http://acm.hust.edu.cn/vjudge/contest/view.action ...
- hdu 2108:Shape of HDU(计算几何,判断多边形是否是凸多边形,水题)
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- hdu 2108 Shape of HDU 判断是否为凸多边形
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Pro ...
- HDU 2108 Shape of HDU (判断是不是凸多边形 叉乘)
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- hdu 2108 Shape of HDU (数学)
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- HDU 2108 Shape of HDU
题解:按照输入顺序依次将点连接起来,对于连续的三个点p0,p1,p2,令向量a=p1-p0,b=p2-p1 若是凸多边形,那么b相对于a一定是向逆时针方向旋转的 判断两向量的旋转方向,可以使用向量的叉 ...
- Hdoj 2108.Shape of HDU 题解
Problem Description 话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后,"徐队"的称呼逐渐被"徐总"所取代,海东 ...
- 【计算几何初步-判断是否凸多边形】【HDU2108】Shape of HDU
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- *HDU 2108 计算几何
Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
随机推荐
- 20170313 ABAP程序未激活状态下保存或激活进入debug
自动进入断点,没有设置的.FUNCTION RS_NEW_PROGRAM_INDEX. https://archive.sap.com/discussions/message/14132983 解决办 ...
- javascript Date对象的介绍及linux时间戳如何在javascript中转化成标准时间格式
1.Date对象介绍 Date对象具有多种构造函数.new Date()new Date(milliseconds)new Date(datestring)new Date(year, month)n ...
- 7-12 畅通工程之最低成本建设问题(30 point(s)) 【PRIME】
7-12 畅通工程之最低成本建设问题(30 point(s)) 某地区经过对城镇交通状况的调查,得到现有城镇间快速道路的统计数据,并提出"畅通工程"的目标:使整个地区任何两个城镇间 ...
- escape() VS encodeURI() VS encodeURIComponent()
JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...
- git多人协作冲突解决方法
http://www.trinea.cn/dev-tools/git-skill/ http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361 ...
- C++中如何计算程序运行的时间 (转载)
转载地址:http://blog.csdn.net/wuxuguang123/article/details/8130081 一 个程序的功能通常有很多种方法来实现,怎么样的程序才算得上最优呢?举个例 ...
- hdu-5748 Bellovin(LIS)
题目链接: Bellovin Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- BZOJ_3786_星系探索_splay维护出栈入栈序
BZOJ_3786_星系探索_splay维护出栈入栈序 Description 物理学家小C的研究正遇到某个瓶颈. 他正在研究的是一个星系,这个星系中有n个星球,其中有一个主星球(方便起见我们默认其为 ...
- angular之两种路由
安装angular npm install -g @angular/cli ng new myapp ng g component componentName 自带路由 引入:angular-rout ...
- python虚拟环境管理包virtualenvwrapper
1.打开cmd 2.安装virtualenvwrapper pip install virtualenvwrapper-win 3.配置虚拟环境的位置 新建系统变量默认在c盘 4.新建虚拟环境 mkv ...