题目链接

对相邻的三个点叉积判断一下就好。

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define pb(x) push_back(x)
#define ll long long
#define mk(x, y) make_pair(x, y)
#define lson l, m, rt<<1
#define mem(a) memset(a, 0, sizeof(a))
#define rson m+1, r, rt<<1|1
#define mem1(a) memset(a, -1, sizeof(a))
#define mem2(a) memset(a, 0x3f, sizeof(a))
#define rep(i, n, a) for(int i = a; i<n; i++)
#define fi first
#define se second
typedef complex <double> cmx;
typedef pair<int, int> pll;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9+7;
const int inf = 1061109567;
const int dir[][2] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1} };
const int maxn = 1005;
int cross(int x1, int y1, int x2, int y2, int x3, int y3) {
return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);
}
int x[maxn], y[maxn];
main()
{
int n;
cin>>n;
n++;
for(int i = 0; i < n; i++){
cin>>x[i]>>y[i];
}
n--;
int ans = 0;
for(int i = 0; i < n; i++){
ans += (cross(x[i], y[i], x[(i+1)%n], y[(i+1)%n], x[(i+2)%n], y[(i+2)%n])>0);
}
cout<<ans<<endl;
}

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【计算几何】

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

  3. [ An Ac a Day ^_^ ] CodeForces 659D Bicycle Race 计算几何 叉积

    问有多少个点在多边形内 求一遍叉积 小于零计数就好了~ #include<stdio.h> #include<iostream> #include<algorithm&g ...

  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. D. Bicycle Race_几何

    D. Bicycle Race time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

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

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

随机推荐

  1. EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配

    C# mvc+EF 运行视图时出现问题:未能加载文件或程序集"EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToke ...

  2. Cordova了解

    概述 Cordova让我们可以使用HTML.JS以及CSS开发跨平台App的公共部分(整个App就是一个WebView或者或者嵌入到本地组件中),与原生API的交互通过Cordova插件实现. 安装配 ...

  3. js获取url传递参数的写法

    获取url地址?后面参数值的写法 正则: function GetQueryString(name) { var reg = new RegExp("(^|&)"+ nam ...

  4. JavaScript 面向对象思想 贪吃蛇游戏

    js代码: 游戏的对象 ,食物,蛇 ,游戏控制思路如下 (完整代码在https://github.com/774044859yf/ObjectSnakeGame下载) var snake = { aS ...

  5. laravel中间件源码分析

    laravel中间件源码分析 在laravel5.2中,HTTP 中间件为过滤访问你的应用的 HTTP 请求提供了一个方便的机制.在处理逻辑之前,会通过中间件,且只有通过了中间件才会继续执行逻辑代码. ...

  6. javascript预加载和延迟加载

    延迟加载javascript,也就是页面加载完成之后再加载javascript,也叫on demand(按需)加载,一般有一下几个方法: What can your tired old page, o ...

  7. Logstash 默认不处理一天前的文件

    The default behavior of the file input plugin is to ignore files whose last modification is greater ...

  8. docker数据管理2

    3. 定义数据卷容器: 只是为了共享数据 docker run -itd -v /data/ --name centeos_testv centos bash /data/ 就是虚拟机内的目录,和宿主 ...

  9. js获得url内的参数

    /** * js获得url内的参数 * 返回值: string or undefined * 使用方法:$_GET['from'] */ var $_GET = (function() { var s ...

  10. UVA 674 Coin Change 换硬币 经典dp入门题

    题意:有1,5,10,25,50五种硬币,给出一个数字,问又几种凑钱的方式能凑出这个数. 经典的dp题...可以递推也可以记忆化搜索... 我个人比较喜欢记忆化搜索,递推不是很熟练. 记忆化搜索:很白 ...