给你三根线段判段是否组成了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. [转] 图解Seq2Seq模型、RNN结构、Encoder-Decoder模型 到 Attention

    from : https://caicai.science/2018/10/06/attention%E6%80%BB%E8%A7%88/ 一.Seq2Seq 模型 1. 简介 Sequence-to ...

  2. NBIoT三种部署方式【转】

    转自:https://472880.kuaizhan.com/89/34/p441944286fccf2 本文作者:吴老司撩通信 本文来源:EETOP NB-IoT支持在频段内(In-Band).保护 ...

  3. LRU 实现缓存

    LRU:Least Recently used 最近最少使用 1.使用LinkedHashMap实现 inheritance实现方式 继承map类 可以使用Collections.synchroniz ...

  4. vue-router路由动态传参query和params的区别

    1.query方式传参和接收参数 //路由 { path: '/detail', //这里不需要参入参数 name: "detail", component: detail//这个 ...

  5. 详解MariaDB数据库的索引

    1.什么是索引 索引是一种特殊的文件(InnoDB数据表上的索引是表空间的一个组成部分),它们包含着对数据表里所有记录的引用指针. 更通俗的说,数据库索引好比是一本书前面的目录,在查找内容之前可以先在 ...

  6. 关于父窗口获取跨域iframe子窗口中的元素

    这几天在项目中遇到,一个难点, 就是需要异步加载一个pdf插件, 同时又需要获取这个插件中的点击事件来生成用户的下载记录. 刚开始也是想了很多方法,网上搜的 格式1:$("#iframe的I ...

  7. CollectionUtils工具类的常用方法

    集合判断:  例1: 判断集合是否为空: CollectionUtils.isEmpty(null): true CollectionUtils.isEmpty(new ArrayList()): t ...

  8. Ubuntu16.04安装编译caffe以及一些问题记录

    前期准备: 最好是python虚拟环境 [anaconda的创建虚拟环境] 创建 conda create -n caffeEnv(虚拟环境名字) python=3.6 激活环境 source act ...

  9. DDD - 概述 - 聚合 - 限界上下文 (四)

    最重要的一句话 DDD的所有有相关理论中,只有一句是至关重要的,但是也是最容易被忽略和最难做到的,抛弃传统的设计方式(思路)的思想,这句话起了决定性的作用,但是99%的人都忽略了或者在开始无法正视或理 ...

  10. java解析json的操作

    import java.io.FileNotFoundException; import java.io.FileReader; import com.google.gson.JsonArray; i ...