#include "stdio.h"
#include "math.h"
#define EPS 1e-8
struct point {
double x, y;
};
struct line {
struct point a, b;
};
double xProduct(struct point a, struct point b) {
return a.x*b.y - a.y*b.x;
}
void judge(struct line l1, struct line l2) {
struct point v1, v2;
v1.x = l1.b.x - l1.a.x;
v1.y = l1.b.y - l1.a.y;
v2.x = l2.b.x - l2.a.x;
v2.y = l2.b.y - l2.a.y;
double prod = xProduct(v1, v2);
if (fabs(prod) < EPS) {
struct point v3;
v3.x = l2.a.x - l1.a.x;
v3.y = l2.a.y - l1.a.y;
if (fabs(xProduct(v1, v3)) < EPS) {
printf("LINE\n");
} else {
printf("NONE\n");
}
} else {
double a = -v1.y;
double b = v1.x;
double c = l1.a.y*l1.b.x - l1.a.x*l1.b.y;
double d = -v2.y;
double e = v2.x;
double f = l2.a.y*l2.b.x - l2.a.x*l2.b.y;
double y = (c*d - f*a) / (b*d - a*e);
double x = (c*e - f*b) / (a*e - b*d);
printf("POINT %.2lf %.2lf\n", x, y);
}
}
int main() {
printf("INTERSECTING LINES OUTPUT\n");
int t;
struct line l1, l2;
scanf("%d", &t);
while (t--) {
scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
&l1.a.x, &l1.a.y, &l1.b.x, &l1.b.y,
&l2.a.x, &l2.a.y, &l2.b.x, &l2.b.y);
judge(l1, l2);
}
printf("END OF OUTPUT\n");
return 0;
}相关推荐
从零构建虚幻引擎体积云:参数调优与性能平衡的艺术
本文深入探讨了在虚幻引擎中构建逼真体积云系统的关键技术,包括Sky Atmosphere、Volumetric Cloud和Exponential Height Fog三大核心组件的协同工作。重点解析了体积云材质的高级控制、光照阴影的物理模拟以及性能优化策略,帮助开发者在视觉效果与性能之间找到最佳平衡点。
POJ 1269 Intersecting Lines(直线相交的判断)
点击打开链接 题意就是, 给你8个点, (x1, y1),( x2, y2), (x3, y3), (x4, y4); 判断这两个直线相交, 平行, 还是重合, 相交输出交点, 平行输出NONE, 重合是LINE; 设直线PQ, 他的方向向量是w = (p0 - q0), 直线上一点是p0,则直线 可 表示为 PQ = p0 + vw* t;若是直线t为0; ...
组态王|通过日历控件选择时间段查询历史报警
哈喽,你好啊,我是雷工!这节记录下查询历史报警信息的功能实现。以下为实现笔记。
poj 1269 Intersecting Lines(判断直线相交 求交点)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6884 Accepted: 3207 Description We all know that a pair of distinct points on a plane
【遥感数字图像处理(朱文泉)】第一章 数字图像基础
关于图像的定义、类型、模拟图像和数字图像
NSFC结题报告下载脚本失效?3步教你手动修复下载按钮问题(2024最新版)
针对NSFC官网域名变更导致结题报告下载脚本失效的问题,本文提供了详细的手动修复指南。通过三步操作,教你如何修改用户脚本的域名匹配规则,恢复下载按钮功能,确保NSFC结题报告下载器能继续高效工作。
poj1269Intersecting Lines【直线相交平行共线的判断+求交点】
Language: Default Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12542 Accepted: 5595 Description We all know that a pair of distinct p
从CD4051到现代模拟开关:40年芯片演进史与选型避坑指南
本文回顾了从CD4051到现代模拟开关的40年技术演进,详细对比了导通电阻、带宽等关键参数的显著提升。通过实际案例和选型矩阵,揭示现代模拟开关在精度、功耗和集成度方面的优势,并提供高精度测量、电池供电等场景的选型策略与避坑指南,帮助工程师优化设计。
POJ 1269 Intersecting Lines(直线相交判断,求交点)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15911 Accepted: 6904 Description We all know that a pair of distinct points on a plane d
Codex入门19-数据库操作(解放双手:用自然语言写SQL、建表和数据迁移)
写 SQL 是后端开发的日常,但复杂的 JOIN、子查询、窗口函数总让人头疼。本文教你用 Codex CLI 实现:自然语言直接生成 CREATE TABLE、复杂 SQL 查询、数据库迁移脚本(Prisma/Knex/Alembic)、ORM 模型代码(SQLAlchemy/TypeORM)、甚至自动生成数据库文档。重点强调安全红线——永远不要让 AI 直接连接生产数据库。从需求描述到完整数据库层代码,一篇搞定。
环保 HJ212协议解析
由于是做环保相关的,有时需要对212协议进行拆包和解包。HJ212协议是一种字符串协议,数据传输通讯包主要由包头、数据段长度、数据段、CRC校验、包尾组成,其中“数据段”内容包括请求编码、系统编码、命令编码、密码、设备唯一标识、总包数、包号、指令参数。请求编码为请求的时间戳,系统编码ST统一规定为22,命令编码CN为该数据包的时间类型,访问密码、设备唯一标识在对接时由平台提供,指令参数为数据内容。通讯协议的数据结构如图4所示。 图4 通讯协议的数据结构 6.1.1通讯包结构组成 名称 类型 长度
POJ1269-Intersecting Lines(判断两条直线平行、重合或者相交)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8789 Accepted: 3965 Description We all know that a pair of distinct points on a plane de
Python爬虫实战:利用Playwright与反反爬技术抓取Crunchbase企业数据
在当今数据驱动的商业环境中,获取准确的企业信息对于市场分析、竞争情报和投资决策至关重要。Crunchbase作为全球领先的企业信息平台,包含了数百万家公司、投资者和关键人员的详细数据。本文将深入探讨如何使用Python最新爬虫技术Playwright,结合多种反反爬策略,高效抓取Crunchbase企业数据。我们将从爬虫基础概念讲起,逐步深入到高级技巧,并提供完整的代码实现,帮助读者掌握现代网络数据采集的核心技术。网络爬虫技术自互联网诞生以来经历了显著演变。
Intersecting Lines(poj1269,判断直线与直线相交)
http://poj.org/problem?id=1269 Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9061 Accepted: 4066 Description We all know that a pair of distinct points on a plan
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。
C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片
基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正
POJ 1269 Intersecting Lines (判断直线是否相交)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12831 Accepted: 5697 Description We all know that a pair of distinct points on a plane def
LinePhone3.2.7(android端最新版本) sip客户端
SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/
poj Intersecting Lines 1269 (数学几何 判断两条直线是否相交)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12837 Accepted: 5702 Description We all know that a pair of distinct points on a plane def
文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况
主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。
POJ-1269-Intersecting Lines(判断直线相交,测板子)
题目链接:http://poj.org/problem?id=1269 题目大意:给出两条直线上的四个点(每条直线两个点),判断这两条直线:1重合(输出LINE),2.平行(输出NONE),3.相交(输出交点)。 思路:测试板子的一道题,把之前总结的板子写上就好了。 ACCode: //#pragma comment(linker, "/STACK:1024000000,10240000...
POJ 1269 Intersecting Lines(判断直线相交)
题目地址:POJ 1269 直接套模板就可以了。。。实在不想自己写模板了。。。写的又臭又长。。。。不过这题需要注意的是要先判断是否有直线垂直X轴的情况。 代码如下: #include #include #include #include #include #include #include #include #include #include #include usi
POJ 1269 Intersecting Lines 判断直线间的状态(平行、重合、相交于一点)
Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8593 Accepted: 3900 Description We all know that a pair of distinct points on a plane
Intersecting Lines POJ - 1269(判断直线相交(交点)、平行、重合)
Intersecting Lines POJ - 1269 题意:给出两条直线,问这两条直线是平行还是相交还是重合 思路:kuangbin模版???????? #include <iostream> #include <cstdio> #include <cmath> #define eps 1e-8 using namespace std; int _; int sgn(double x) { if(fabs(x) < eps)return 0; if(x
POJ 1269 Intersecting Lines 直线相交判断
D - Intersecting Lines Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1269 Appoint description: System Crawler (2016-05-08)
POJ 1269 Intersecting Lines【判断直线相交】
题意:给两条直线,判断相交,重合或者平行 思路:判断重合可以用叉积,平行用斜率,其他情况即为相交。 求交点: 这里也用到叉积的原理。假设交点为p0(x0,y0)。则有: (p1-p0)X(p2-p0)=0 (p3-p0)X(p2-p0)=0 展开后即是 (y1-y2)x0+(x2-x1)y0+x1y2-x2y1=0 (y3-y4)x0+(x4-x3)y0+x3y4-x4y3=0 ...
POJ 1269 Intersecting Lines(直线相交判断,求交点)
题意 : 就是让你求直线是否相交,若相交求出交点题解 :先要有一个意识就是求直线方程不是很麻烦,我就是被这个给坑了,会求直线方程这个问题就解决了 剩下的就是解方程了 (注意斜率不存在的情况就好了)#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <cmath> using na
poj 1269 Intersecting Lines(直线相交判断,求相交交点)
常规而又直接的计算几何判断直线是否相交题目,如果相交,求相交的交点 在这里要注意两点: 1、scanf()输入double型数据要用%lf 2、用一般式(Ax+By+C=0)判断的直线时候记住重合的充要条件是 A2B1-A1B2==0 && A1C2-C1A2==0 && B1C2-C1B2==0(初高中的几何知识全还给老师了,(-_-)) 我犯错的时候是用A2B1-A1B2==0 &&
POJ - 1269:Intersecting Lines__判断两直线相交
Description We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are paral
poj 1269Intersecting Lines (直线相交判断,求相交交点)
DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2)
938



被折叠的 条评论
为什么被折叠?



