#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<cstring>
#include<queue>
#include<set>
#include<string>
#include<map>
#include <time.h>
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef double db;
const int maxn = +;
const int sigma=;
const ll mod = ;
const int INF = 0x3f3f3f;
const db eps = 1e-;
struct point {
db x, y;
point(db x=, db y=):x(x), y(y) {}
}s1, e1, s2, e2; typedef point Vector;
Vector operator - (point A, point B) {
return Vector(A.x-B.x, A.y-B.y);
}
db Cross(point A, point B) {
return A.x*B.y-B.x*A.y;
}
void solve() {
scanf("%lf%lf%lf%lf", &s1.x, &s1.y, &e1.x, &e1.y);
scanf("%lf%lf%lf%lf", &s2.x, &s2.y, &e2.x, &e2.y);
Vector CA=s1-s2;
Vector CD=e2-s2;
Vector CB=e1-s2;
db s=Cross(CA, CD)*Cross(CB, CD);
Vector AC=s2-s1;
Vector AB=e1-s1;
Vector AD=e2-s1;
db ss=Cross(AC, AB)*Cross(AD, AB);
// cout<<s<<" "<<ss<<endl;
if (s<= && ss<=) puts("Interseetion");
else puts("Not Interseetion");
}
int main() {
int t = ;
// freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
scanf("%d", &t);
while(t--) {
solve();
}
return ;
}

NYOJ 1016 判断两线段是否相交的更多相关文章

  1. You can Solve a Geometry Problem too(判断两线段是否相交)

    You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/3 ...

  2. Pick-up sticks--poj2653(判断两线段是否相交)

    http://poj.org/problem?id=2653 题目大意:有n根各种长度的棍   一同洒在地上 求在最上面的棍子有那几个 分析:  我刚开始想倒着遍历  因为n是100000   想着会 ...

  3. You can Solve a Geometry Problem too (hdu1086)几何,判断两线段相交

    You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3276 ...

  4. hdu 1086:You can Solve a Geometry Problem too(计算几何,判断两线段相交,水题)

    You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/3 ...

  5. hdu 1147:Pick-up sticks(基本题,判断两线段相交)

    Pick-up sticks Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  6. poj 1127:Jack Straws(判断两线段相交 + 并查集)

    Jack Straws Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2911   Accepted: 1322 Descr ...

  7. UVALive7461 - Separating Pebbles 判断两个凸包相交

    //UVALive7461 - Separating Pebbles 判断两个凸包相交 #include <bits/stdc++.h> using namespace std; #def ...

  8. 如何判断单链表是否存在环 & 判断两链表是否相交

    给定一个单链表,只给出头指针h: 1.如何判断是否存在环? 2.如何知道环的长度? 3.如何找出环的连接点在哪里? 4.带环链表的长度是多少? 解法: 1.对于问题1,使用追赶的方法,设定两个指针sl ...

  9. poj 1127 -- Jack Straws(计算几何判断两线段相交 + 并查集)

    Jack Straws In the game of Jack Straws, a number of plastic or wooden "straws" are dumped ...

随机推荐

  1. Android开发之getX,getRawX,getWidth,getTranslationX等的区别

    转载请注明出处:http://blog.csdn.net/dmk877/article/details/51550031      好久没写博客了,最近工作确实挺忙的,刚刚结束了一个TV项目的开发,对 ...

  2. NDK环境搭建方法1

    1.新建NdkDemo工程 2.新建NdkJniUtils类,在内部声明native方法 3.引用 4.build项目,生成NdkDemo\app\build\intermediates\classe ...

  3. centos如何查看磁盘剩余空间

    linux系统的Df命令是以磁盘分区为单位查看文件系统,可以加上参数查看磁盘剩余空间信息,命令格式: df -hl 显示格式为: 文件系统 容量 已用 可用 已用% 挂载点 /dev/hda5 487 ...

  4. elk6快速安装

    rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch [elasticsearch-6.x] name=Elasticsear ...

  5. Numpy函数库基础

    利用Numpy函数库构造4*4随机数组,然后将数组转化为矩阵,然后矩阵与其逆矩阵相乘,计算机处理的误差 from numpy import * random.rand(4,4) print(rando ...

  6. SecureCRT 上传下载

    1.菜单栏Options-Session Options-SFTP Session 设置上传/下载目录 2.选择File-Connect SFTP Session进入SFTP窗口 3.命令 ls pw ...

  7. unity缓动插件DOTween Pro v0.9.680

    DoTween Pro是一款unity插件,是unity中最好用的tween插件,比起Dotween的免费版要多很多功能,实现脚本和视觉脚本的新功能,支持包括移动,淡出,颜色,旋转,缩放,打孔,摇动, ...

  8. 微信小程序开发——全局配置详细介绍

    本文针对官方文档未说明清楚的进行详细探索研究,官方文档详见:全局配置 . pages: 删除页面,需要先删除app.json中pages对应页面的路径,再去删除页面相关的所有文件,不然会出现页面文件混 ...

  9. 六.Spring与RabbitMQ集成--HelloWorld

    spring对RabbitMQ做了很好的集成,我们称之为spring AMQP,其官方文档写得十分详尽,文档地址:https://docs.spring.io/spring-amqp/referenc ...

  10. DBCO

    实现SAP连接外部数据库 也可用SM30维护DBCON的内容 SAP提供了对原生sql的操作,主要有以下几个类组成: CL_SQL_STATEMENT - Execution of SQL State ...