问有多少个点在多边形内

求一遍叉积 小于零计数就好了~

 #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#define M(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
struct point{
int x,y;
}pnt[];
int solve(point a,point b,point c){
return (b.x-a.x)*(c.y-b.y)-(c.x-b.x)*(b.y-a.y);
}
int main(){
int n;
scanf("%d",&n);
n++;
for(int i=;i<n;i++)
scanf("%d%d",&pnt[i].x,&pnt[i].y);
int ans=;
for(int i=;i<n;i++)
if(solve(pnt[i-],pnt[i-],pnt[i])>) ans++;
printf("%d\n",ans);
return ;
}
/* 6
0 0
0 1
1 1
1 2
2 2
2 0
0 0 16
1 1
1 5
3 5
3 7
2 7
2 9
6 9
6 7
5 7
5 3
4 3
4 4
3 4
3 2
5 2
5 1
1 1 */

[ An Ac a Day ^_^ ] CodeForces 659D Bicycle Race 计算几何 叉积的更多相关文章

  1. CodeForces 659D Bicycle Race (判断点是否为危险点)

    D - Bicycle Race Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u S ...

  2. codeforces 659D . Bicycle Race 几何

    题目链接 对相邻的三个点叉积判断一下就好. #include <iostream> #include <vector> #include <cstdio> #inc ...

  3. Codeforces 659D Bicycle Race【计算几何】

    题目链接: http://codeforces.com/contest/659/problem/D 题意: 若干条直线围城的湖,给定直线的端点,判断多少个转点会有危险?(危险是指直走的的话会掉进水里) ...

  4. codeforces 659D D. Bicycle Race(水题)

    题目链接: D. Bicycle Race time limit per test 1 second memory limit per test 256 megabytes input standar ...

  5. Codeforces Round #346 (Div. 2) D Bicycle Race

    D. Bicycle Race 题目链接http://codeforces.com/contest/659/problem/D Description Maria participates in a ...

  6. (求凹包) Bicycle Race (CF 659D) 简单题

    http://codeforces.com/contest/659/problem/D     Maria participates in a bicycle race. The speedway t ...

  7. Codeforces Round #346 (Div. 2) D. Bicycle Race 叉积

    D. Bicycle Race 题目连接: http://www.codeforces.com/contest/659/problem/D Description Maria participates ...

  8. 2016NEFU集训第n+3场 D - Bicycle Race

    Description Maria participates in a bicycle race. The speedway takes place on the shores of Lake Luc ...

  9. Codeforces Gym 100733A Shitália 计算几何

    ShitáliaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.acti ...

随机推荐

  1. android 沉浸式状态栏的实现

    本文介绍一种简单的实现沉浸式状态栏的方法,要高于或等于api19才可以. 实现android沉浸式状态栏很简单,添加代码两步就可以搞定. 一.在activity中添加 getWindow().addF ...

  2. Android studio自动删除没用的资源

    有时候我们添加的一些资源,如图片和一些没用的代码,以及在添加第三方库的时候我们只需要使用其中的一部分功能和一部分资源,那么这个时候如果靠我们手工去怕是非常难做的,尤其是项目大的时候,Android 团 ...

  3. RTMP直播应用与延时分析

    直播应用中,RTMP和HLS基本上可以覆盖所有客户端观看,HLS主要是延时比较大,RTMP主要优势在于延时低. 一.应用场景 低延时应用场景包括:  .  互动式直播:譬如2013年大行其道的美女主播 ...

  4. Python学习笔记——基础篇【第六周】——Subprocess模块

    执行系统命令 可以执行shell命令的相关模块和函数有: os.system os.spawn* os.popen*          --废弃 popen2.*           --废弃 com ...

  5. validate验证

    导入需要的js          自动验证 <script src="${ctx }/static/assets/js/jquery-2.1.4.min.js">< ...

  6. Asp.Net BulletedList使用及详解

    BulletedList使用及详解   文章来源:www.cnblogs.com/xiohao/archive/2013/10/09/3359263.html BulletedList是一个让你轻松在 ...

  7. Framebuffer的配置及应用——先转载留着,以后一定要弄懂

    http://blog.csdn.net/tju355/article/details/6881389   借助于framebuffer,我们能够在console下面作很多事情.首先下载framebu ...

  8. C++线程安全的单例模式

    1.在GCC4.0之后的环境下: #include <iostream> using namespace std;template <typename T>class Sing ...

  9. MVC修改文件上传大小问题

    在web.config文件的system.web节点的httpRuntime节点加入 maxRequestLength="2147483647" executionTimeout= ...

  10. SQL语句的优化

    1.创建索引 表中数据经常需要用的哪些字段数据进行过滤,则添加该字段的索引,索引相当如一本书的目录,能加快查询数据的速度:同时在新建索引的时候,将需要查询的列,在包含性 列中新增上去,能减少查询语句的 ...