codeforces 13 b
给你三根线段判段是否组成了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的更多相关文章
- codeforces 13 D
给你500个红点和蓝点,让你找多少点红点构成的三角形里没有蓝点. 巧妙啊!我们考虑一个很远位置的点,不妨设这个为O,然后n^2枚举红点,考虑Oij里面蓝点的个数, 然后 对于 ijk这个三角形,我们可 ...
- Codeforces Beta Round #13 C. Sequence (DP)
题目大意 给一个数列,长度不超过 5000,每次可以将其中的一个数加 1 或者减 1,问,最少需要多少次操作,才能使得这个数列单调不降 数列中每个数为 -109-109 中的一个数 做法分析 先这样考 ...
- Codeforces Beta Round #13 E. Holes 分块暴力
E. Holes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/13/problem/E Des ...
- Educational Codeforces Round 13 D:Iterated Linear Function(数论)
http://codeforces.com/contest/678/problem/D D. Iterated Linear Function Consider a linear function f ...
- Educational Codeforces Round 13 D. Iterated Linear Function (矩阵快速幂)
题目链接:http://codeforces.com/problemset/problem/678/D 简单的矩阵快速幂模版题 矩阵是这样的: #include <bits/stdc++.h&g ...
- 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/ ...
- Educational Codeforces Round 13 E. Another Sith Tournament 状压dp
E. Another Sith Tournament 题目连接: http://www.codeforces.com/contest/678/problem/E Description The rul ...
- Educational Codeforces Round 13 D. Iterated Linear Function 水题
D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...
- Educational Codeforces Round 13 C. Joty and Chocolate 水题
C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...
随机推荐
- Python 自然语言处理(1)中文分词技术
中文分词技术 中文自动分词可主要归纳为“规则分词”“统计分词”和“混合分词”,规则分词主要是通过人工设立词库,按照一定方式进行匹配切分,实现简单高效,但对新词很难进行处理,统计分词能够较好应对新词发现 ...
- Spring Cloud 之 服务注册与发现实战
一. 启动Eureka Server集群 准备二台云主机,二个eureka server服务互相进行复制.准备二个application.yml配置,分别如下: application-server1 ...
- 微信小程序开发学习(一)
一.各种JSON配置 1.小程序配置app.json 为小程序全局配置,包括所有页面路径.界面表现.网络超时时间.底部tab等,类比APP开发中manifest配置. 2.工具配置project.co ...
- 基于python的WGS84转百度坐标
from urllib.request import urlopen, quote import json def wgs84tobaidu(x,y): data=str(x)+','+str(y); ...
- 删除 $PATH 路径下多余的文件地址
将如下去 多余文件删除就可以了
- Lesson 2-1 (数据结构,序列通用的操作)
2.0 数据结构 --- 数据结构是以某种方式组合起来的数据元素集合. --- python的常见的数据结构 2.1 序列(sequence) --- 序列中的每个元素都有编号,即索引(也称为下标). ...
- Lesson 1-2
1.5 模块 模块可视为扩展,通过将其导入可以扩展python的功能.python中自带有一组模块,也称为“标准库”. 1.5.1 模块的导入:import + 模块名称 • 使用关键字import导 ...
- 将Go的main包拆分为多个文件
将Go的main包拆分为多个文件的写法和普通包是完全一致的,其使用规则也相同.如编写main包结构如下: main |----main.go |----show.go 在main.go中编写了main ...
- 记录下在阿里云linux上安装与配置Mysql
环境:阿里云ECS服务器,系统为centos7.2 用户:root 参考博客:https://blog.csdn.net/kunzai6/article/details/81938613 师兄的哈哈哈 ...
- CAS5.3.0安装部署
部署环境:JDK1.8.x maven-3.5.2 tomcat-8.x.x 1.下载地址 https://github.com/apereo/cas-overlay-template/tree/5. ...