给你三根线段判段是否组成了A

条件,两条线段交于端点并且夹角不大于90,第三条线段端点在两条线段上并且划分的大小满足 大:小<4:1

注释很全。(主要是我记不清楚了,,好像过了一个多星期了)

 #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long db;
int inmid(db k1,db k2,db k3){return (k1-k3)*(k2-k3)<=;}// k3 在 [k1,k2] 内
struct point{
ll x,y;
point operator + (const point &k1) const{return (point){k1.x+x,k1.y+y};}
point operator - (const point &k1) const{return (point){x-k1.x,y-k1.y};}
point operator * (db k1) const{return (point){x*k1,y*k1};}
point operator / (db k1) const{return (point){x/k1,y/k1};}
int operator == (const point &k1) const{return x==k1.x&&y==k1.y;}
};
int inmid(point k1,point k2,point k3){return inmid(k1.x,k2.x,k3.x)&&inmid(k1.y,k2.y,k3.y);}
ll cross(point k1,point k2){return k1.x*k2.y-k1.y*k2.x;}
ll dot(point k1,point k2){return k1.x*k2.x+k1.y*k2.y;}
struct line {
// p[0]->p[1]
point p[];
line(point k1, point k2) {p[] = k1;p[] = k2;}
point &operator[](int k) { return p[k]; }
};
ll cross(line a,line b){return cross(a[]-a[],b[]-b[]);}
ll dot(line a,line b){return dot(a[]-a[],b[]-b[]);}
int t;point p[];
vector<line> l;
bool check(ll x,ll y){if(x*<y)return ;if(x*>y*)return ;return ;}
bool slove(line a,line b,line c){
if(a[]==b[])swap(a[],a[]),swap(b[],b[]);
if(a[]==b[])swap(a[],a[]);
if(a[]==b[])swap(b[],b[]);
if(!(a[]==b[]))return ;//判相交
if(cross(a,b)==)return ;//重合
if(dot(a,b)<)return ;//夹角
if(cross(a[]-a[],c[]-a[])==&&cross(b[]-b[],c[]-b[])==){}
else swap(c[],c[]);
if(!(cross(a[]-a[],c[]-a[])==&&cross(b[]-b[],c[]-b[])==))return ;//共线
if(!inmid(a[],a[],c[]))return ;//在线段上
if(!inmid(b[],b[],c[]))return ;
//比例
if(!check(abs(a[].x-c[].x),abs(a[].x-a[].x)))return ;
if(!check(abs(a[].y-c[].y),abs(a[].y-a[].y)))return ;
if(!check(abs(b[].x-c[].x),abs(b[].x-b[].x)))return ;
if(!check(abs(b[].y-c[].y),abs(b[].y-b[].y)))return ;
return ;
} int main(){
scanf("%d",&t);
while(t--){
l.clear();
for(int i=;i<=;i++)scanf("%lld%lld",&p[i].x,&p[i].y);
l.push_back({p[],p[]});l.push_back({p[],p[]});l.push_back({p[],p[]});
if(slove(l[],l[],l[]))cout<<"YES"<<endl;
else if(slove(l[],l[],l[]))cout<<"YES"<<endl;
else if(slove(l[],l[],l[]))cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
/**
1
0 0 0 6
0 6 2 -4
1 1 0 1
*/

codeforces 13 b的更多相关文章

  1. codeforces 13 D

    给你500个红点和蓝点,让你找多少点红点构成的三角形里没有蓝点. 巧妙啊!我们考虑一个很远位置的点,不妨设这个为O,然后n^2枚举红点,考虑Oij里面蓝点的个数, 然后 对于 ijk这个三角形,我们可 ...

  2. Codeforces Beta Round #13 C. Sequence (DP)

    题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...

  3. Codeforces Beta Round #13 E. Holes 分块暴力

    E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Des ...

  4. Educational Codeforces Round 13 D:Iterated Linear Function(数论)

    http://codeforces.com/contest/678/problem/D D. Iterated Linear Function Consider a linear function f ...

  5. Educational Codeforces Round 13 D. Iterated Linear Function (矩阵快速幂)

    题目链接:http://codeforces.com/problemset/problem/678/D 简单的矩阵快速幂模版题 矩阵是这样的: #include <bits/stdc++.h&g ...

  6. 2016-2017 CT S03E06: Codeforces Trainings Season 3 Episode 6(8/13)

    2016-2017 CT S03E06: Codeforces Trainings Season 3 Episode 6 比赛连接: http://codeforces.com/gym/101124/ ...

  7. Educational Codeforces Round 13 E. Another Sith Tournament 状压dp

    E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...

  8. Educational Codeforces Round 13 D. Iterated Linear Function 水题

    D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...

  9. Educational Codeforces Round 13 C. Joty and Chocolate 水题

    C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...

随机推荐

  1. P5304 [GXOI/GZOI2019]旅行者

    题目地址:P5304 [GXOI/GZOI2019]旅行者 这里是官方题解 一个图 \(n\) 点 \(m\) 条边,里面有 \(k\) 个特殊点,问这 \(k\) 个点之间两两最短路的最小值是多少? ...

  2. 项目Alpha冲刺(团队)-第一天冲刺

    格式描述 课程名称:软件工程1916|W(福州大学) 作业要求:项目Alpha冲刺(团队)-代码规范.冲刺任务与计划 团队名称:为了交项目干杯 作业目标:描述第一天冲刺的项目进展.问题困难.心得体会 ...

  3. 关于/tmp/ 目录自动清理文件

    问题:今天开发人员给我说了一个错误:The temporary upload location [/tmp/tomcat.1337767218595042057.80/work/Tomcat/loca ...

  4. 【easy】438.Find All Anagrams in a String 找出字符串中所有的变位词

    Input: s: "abab" p: "ab" Output: [0, 1, 2] Explanation: The substring with start ...

  5. 爬虫 解析库re,Beautifulsoup,

    re模块 点我回顾 Beautifulsoup模块 #安装 Beautiful Soup pip install beautifulsoup4 #安装解析器 Beautiful Soup支持Pytho ...

  6. Springboot+Mybaits之两张表同时插入数据

    项目需求是,一张表添加数据的同时,另外一张表也需要添加数据,话不多说,直接上代码. 1.Controller,我把两个DTO直接放到一个@RequestBody中.其中throws是后台获取当前时间抛 ...

  7. 《利用Python进行数据分析·第2版》

    <利用Python进行数据分析·第2版> 第 1 章 准备工作第 2 章 Python 语法基础,IPython 和 Jupyter第 3 章 Python 的数据结构.函数和文件第 4 ...

  8. python读取uti-8格式ini配置文件出现UnicodeDecodeError: 'gbk' codec can't decode byte 0xba in position 367: illegal multibyte sequence错误解决方法

    出现这种错误只需要在read下添加encoding='utf-8' 如: from configparser import ConfigParser cf = ConfigParser() cf.re ...

  9. cocos creator 动画编辑器以及骨骼动画的使用

    一.普通动画的设置 1.添加动画组件 a.添加空节点=>添加动画组件 b.新建Clip文件=>打开编辑模式添加动画编辑(并且把添加的clip文件拖动到右边面板的Default Clip 与 ...

  10. 1024 Python 要诀

    在medium看到一篇好文,给初学者的Python小技巧,非常实用,可以用在你的程序中,代码瞬间变得高大上,看起来还有Pythonic 的感觉,Talk is cheap show me the co ...