题意:给n个点,问是否能两条平行线覆盖所有的点

思路:因为要求全部覆盖,所以我们第一个点肯定是会入其中一条直线,其实只用判前三个点的所有情况即可

#include<stdio.h>
#include<set>
#include<algorithm>
using namespace std; int a[],n;
set<double>s; bool judge(double k)
{
s.clear();
for(int i=; i<=n; ++i)
s.insert(a[i]*1.0-k*i);
return s.size()==;
} int main()
{
scanf("%d",&n);
for(int i=; i<=n; ++i)
scanf("%d",&a[i]);
if(judge((a[]-a[])/1.0)||judge((a[]-a[])/1.0)||judge((a[]-a[])/2.0))
printf("Yes\n");
else
printf("No\n");
return ;
}

CodeForces - 849B 几何的更多相关文章

  1. An overnight dance in discotheque CodeForces - 814D (几何)

    大意: 给定n个不相交的圆, 求将n个圆划分成两部分, 使得阴影部分面积最大. 贪心, 考虑每个连通块, 最外层大圆分成一部分, 剩余分成一部分一定最优. #include <iostream& ...

  2. [CodeForces]CodeForces 13D 几何 思维

    大致题意: 给出N个红点和M个蓝点,问可以有多少个红点构成的三角形,其内部不含有蓝点 假设我们现在枚举了一条线段(p[i],p[j]),我们可以记录线段下方满足(min(p[i].x,p[j].x)& ...

  3. Codeforces 849B Tell Your World (计算几何)

    题目链接 Tell Your World 题意 给出N个点(i, xi),问是否存在两条平行的直线,使得每一个点恰好在两条直线的其中一条上. 每条直线必须穿过至少一个点. 考虑每个点和第1个点的斜率, ...

  4. ACM: CodeForces 140A New Year Table-数学几何

    CodeForces 140A New Year Table Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d ...

  5. Codeforces Round #172 (Div. 2) C. Rectangle Puzzle 数学题几何

    C. Rectangle Puzzle Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/281/p ...

  6. CodeForces 459A Pashmak and Garden(水~几何-给两点求两点组成正方形)

    题目链接:http://codeforces.com/problemset/problem/459/A 题目大意: 给出两个点(在坐标轴中),求另外两个点从而构成一个正方形,该正方形与坐标轴平行. 如 ...

  7. Codeforces 842B Gleb And Pizza【几何,水】

    B. Gleb And Pizza time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  8. Codeforces 793C - Mice problem(几何)

    题目链接:http://codeforces.com/problemset/problem/793/C 题目大意:给你一个捕鼠器坐标,和各个老鼠的的坐标以及相应坐标的移动速度,问你是否存在一个时间点可 ...

  9. CodeForces 342C Cupboard and Balloons (几何问题)

    题意:给定一个 r 和 h,r 是上面那个半球的半径,h 是下面那个圆柱的高度,然后有一些半径为 r/2的气球,问你最多能放几个. 析:根据题意,很容易知道,先从下面往上放,两个两个的放,放到不能放的 ...

随机推荐

  1. 疑难杂症——解决 Cinder 僵尸卷问题

    目录 目录 问题描述 问题解决 最后 问题描述 Cinder 的僵尸卷一般是因为操作不当导致分配的卷无法正常使用且无法正常分离或删除. 问题解决 解决僵尸卷问题的思路类似解决 Linux 系统中的僵尸 ...

  2. 思维导图初体验——openstack

    RABBITMQ memcache keystone glance nova neutron horizon cinder ceph

  3. Delphi中Tlist实例

    http://blog.163.com/jiandande3218@126/blog/static/74728469201132721428194/ Delphi中Tlist实例 2011-04-27 ...

  4. vue的概述

    一.Vue的概述 Vue的开发模式 和 之前接触的jQuery.原生JSDOM操作是不同的,之前要想修改试图,首先找元素:在使用Vue时,专心把精力放在修改数据.DOM驱动 ---> 数据驱动. ...

  5. 获取jQuery DataTables 的checked选中行

    $(function () { var  tabel = $('#userlist').DataTable({        destroy: true, //Cannot reinitialise ...

  6. selenium python 报错“ unable to find binary in default location”

    selenium python 报错如下: raise exception_class(message, screen, stacktrace)selenium.common.exceptions.W ...

  7. U盘修复教程--使用量产工具和芯片检测工具

    U盘修复教程(金士顿DT101) 本教程使用量产工具(量产可理解为强制恢复出厂设置),量产有风险(U盘彻底报废),根据教程所造成所有损失均与本文作者无关. ·第一步:下载ChipGenius_v4_0 ...

  8. dp(最长公共上升子序列)

    This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence ...

  9. anaconda安装教程、管理虚拟环境

    原文链接:https://blog.csdn.net/ITLearnHall/article/details/81708148 另可参看文章:https://www.cnblogs.com/jonin ...

  10. 数据导出 写入到excle文件

    import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.poi ...