#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. linux下的C++项目创建

    CMake项目的完整构建 Linux下的CMake项目通常由几个文件夹组成.小伙伴们可以先在自己的电脑上新建一个文件夹,作为你代码的根目录,然后往里面建几个子文件夹,这里并不涉及具体的代码,只是可以作 ...

  2. [转]github详细教程

    GitHub详解 GitHub 是一个共享虚拟主机服务,用于存放使用Git版本控制的软件代码和内容项目.它由GitHub公司(曾称Logical Awesome)的开发者Chris Wanstrath ...

  3. Angular之模版引用变量

    A template reference variable is often a reference to a DOM element within a template. It can also b ...

  4. QT各模块

    基本模块: QT core QT gui QT widgets QT multimedia QT webkit 浏览器引擎 QT network QT sql QT test 单元测试 QT webv ...

  5. vue 路由参数变化,页面不更新的问题

    监控$route 在vue项目中,假使我们在同一个路由下,只是改变路由后面的参数值,如果不监听路由参数值的变化,页面无数据刷新,需手动刷新浏览器,这样做就不是我们的预期效果. 举例:当前路由为  /p ...

  6. 【python】初识python

    [命名规范] 模块名:小写字母,单词之间用_分割:例如:ad_stats.py 包名:和模块名一样 类名:单词首字母大写:例如:ConfigUtil 全局变量名:大写字母,单词之间用_分割:例如:NU ...

  7. [LeetCode_105]Construct Binary Tree from Preorder and Inorder Traversal

    题目链接 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 题意 由二叉 ...

  8. 【php 之获得当前日期以及比较日期大小】

    首先看一个例子: $currentTime = date('Y-m-d H:i'); // 获得当前时间 $timer = $searchDated . ' ' . $results['ctrip'] ...

  9. elasticsearch查询语句总结

    query 和  filter 的区别请看:https://www.cnblogs.com/bainianminguo/articles/10396956.html Filter DSL term 过 ...

  10. JAVA EXAM2 复习提纲

    [真假分数相加] //inheritence, extends, use this & super 子类的方法 //two constructors, non-default use 'thi ...