POJ 1269 Intersecting Lines

【RT-DETR涨点改进】全网独家首发、特征融合改进篇 | AAAI 2026 | 引入CDEM交叉动态增强模块,双向引导和融合,在低光图像增强中有效提升了图像的亮度,提升小目标和暗目标的检测准确率 本文提出了一种基于CDEM(交叉动态增强模块)改进的rtdetr网络模型,有效提升了在低光和复杂环境下的目标检测性能。CDEM模块通过动态增强亮度与色彩特征,改善图像输入质量,增强细节和对比度。该模块具有轻量级结构,易于集成到现有模型中,能够显著提升小目标和暗目标的检测准确率与鲁棒性。文章详细介绍了CDEM模块的结构原理、实现方法,并提供了完整的代码实现和配置指南,包括三种改进版本的YAML配置文件。实验结果表明,该方法在图像增强和目标检测任务中均取得了优异性能。 阅读详情
Intersecting Lines
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 6233 Accepted: 2939

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 parallel, 2) intersect in a line because they are on top of one another (i.e. they are the same line), 3) intersect in a point. In this problem you will use your algebraic knowledge to create a program that determines how and where two lines intersect. 
Your program will repeatedly read in four points that define two lines in the x-y plane and determine how and where the lines intersect. All numbers required by this problem will be reasonable, say between -1000 and 1000. 

Input

The first line contains an integer N between 1 and 10 describing how many pairs of lines are represented. The next N lines will each contain eight integers. These integers represent the coordinates of four points on the plane in the order x1y1x2y2x3y3x4y4. Thus each of these input lines represents two lines on the plane: the line through (x1,y1) and (x2,y2) and the line through (x3,y3) and (x4,y4). The point (x1,y1) is always distinct from (x2,y2). Likewise with (x3,y3) and (x4,y4).

Output

There should be N+2 lines of output. The first line of output should read INTERSECTING LINES OUTPUT. There will then be one line of output for each pair of planar lines represented by a line of input, describing how the lines intersect: none, line, or point. If the intersection is a point then your program should output the x and y coordinates of the point, correct to two decimal places. The final line of output should read "END OF OUTPUT".

Sample Input

5
0 0 4 4 0 4 4 0
5 0 7 6 1 0 2 3
5 0 7 6 3 -6 4 -3
2 0 2 27 1 5 18 5
0 3 4 0 1 2 2 5

Sample Output

INTERSECTING LINES OUTPUT
POINT 2.00 2.00
NONE
LINE
POINT 2.00 5.00
POINT 1.07 2.20
END OF OUTPUT

Source


求俩直线关系的,相交,平行,或重合。

基础的计算几何~一点点建立起计算几何的自信~

推了下求交点的公式

首先看图


两直线AB,CD相交于O点

设q = 向量AC与向量DC的叉积 = AG * CD

    p = 向量AB与向量DC的叉积 = (AG + BH) * CD

得AG / (AG + BH) = q / p

因为BHO和AGO是相似三角形,所以

得 AO / AB = AO / (AO + OB) = AG / (AG + BH) = q / p

于是AO = AB * q / p

即O.x - A.x = (B.x - A.x) * q / p

    O.y - A.y = (B.y - A.y) * q / p


剩下的

两直线重合:

C,D点一定在AB上,所以,(X表示叉积)

CB X AB = DB X AB = 0

两直线平行:

AB X CD = 0

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const double eps = 0.000001;

struct LPoint{
	double x, y;
};
struct LLine{
	LPoint bg, ed;
};

int dblcmp(double a, double b){
	if (a - b > eps) return 1;
	if (b - a > eps) return -1;
	return 0;
}

double VecPro(double a, double b, double p, double q){
	return (a * q) - (b * p);
}

int main(){
	int n;
	double p, q, t;
	LLine a, b;
	LPoint o;
	scanf("%d", &n);
	printf("INTERSECTING LINES OUTPUT\n");
	while(n--){
		scanf("%lf%lf%lf%lf", &a.bg.x, &a.bg.y, &a.ed.x, &a.ed.y);
		scanf("%lf%lf%lf%lf", &b.bg.x, &b.bg.y, &b.ed.x, &b.ed.y);
		p = VecPro(a.bg.x - a.ed.x, a.bg.y - a.ed.y, b.bg.x - a.ed.x, b.bg.y - a.ed.y);
		q = VecPro(a.bg.x - a.ed.x, a.bg.y - a.ed.y, b.ed.x - a.ed.x, b.ed.y - a.ed.y);
		t = VecPro(a.bg.x - a.ed.x, a.bg.y - a.ed.y, b.bg.x - b.ed.x, b.bg.y - b.ed.y);
		if (dblcmp(p, 0) == 0 && dblcmp(q, 0) == 0){
			printf("LINE\n");
		}else if (dblcmp(t, 0) == 0){
			printf("NONE\n");
		}else{
			p = VecPro(b.ed.x - b.bg.x, b.ed.y - b.bg.y, a.bg.x - b.bg.x, a.bg.y - b.bg.y);
			p = p / t;
			o.x = a.bg.x + p * (a.ed.x - a.bg.x);
			o.y = a.bg.y + p * (a.ed.y - a.bg.y);
			printf("POINT %0.2f %0.2f\n", o.x, o.y);
		}
	}
	printf("END OF OUTPUT\n");
	return 0;
}



VC中sqlite的使用 在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示 立即下载

相关推荐

nRF52840 低功耗蓝牙开发指南:从硬件架构到物联网应用实战

本文深入解析nRF52840低功耗蓝牙芯片的硬件架构与开发实践,涵盖从开发环境搭建到BLE协议栈开发的详细指南。通过实战案例分享低功耗优化技巧,帮助开发者高效实现物联网应用,特别适合智能家居和工业场景。

d3e4f的博客 414

poj 1269 Intersecting Lines

Intersecting Lines Time Limit: 1000MS   Memory Limit: 10000KB   64bit IO Format: %I64d & %I64u [Submit]

codeStone 1019

PCB布局布线要求及多层电路板叠加原则

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。提示:以下是本篇文章正文内容,下面案例可供参考本文主要针对PCB布局布线中的要点进行了总结,并对多层电路板的叠加原则进行了解释。

Ka_wyb的博客 2932

寒假训练营之计算几何:C - Intersecting Lines

C - Intersecting Lines POJ - 1269 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 becau...

serendipity的博客 236

Arduino-Pico:用Arduino生态开发树莓派RP2040双核与PIO实战

在嵌入式开发领域,微控制器编程是连接硬件与软件的核心技能。其原理在于通过编写代码直接控制处理器与外设,实现特定功能。掌握这项技术能极大提升开发效率,降低硬件操作门槛,广泛应用于物联网、智能硬件和自动化控制等场景。本文聚焦于如何利用Arduino这一广受欢迎的生态,来开发树莓派RP2040微控制器。RP2040以其双核Cortex-M0+架构和独特的可编程IO(PIO)硬件而著称,性能强大。通过第三方Arduino核心(arduino-pico),开发者可以沿用熟悉的Arduino语法和库,快速调用双核并行处

weixin_26905423的博客 381

用友U8登录慢卡顿?别急着重启服务器,先检查UA_Message这张表(附SQL清理脚本)

本文针对用友U8登录慢卡顿问题,深入分析UA_Message表积压消息对系统性能的影响,并提供SQL清理脚本和优化方案。通过诊断、清理、索引优化和预防措施四步法,显著提升U8客户端登录速度,适用于后台管理和数据库维护场景。

weixin_28726671的博客 380

poj 2653 Intersecting Lines

题目链接:http://poj.org/problem?id=1269 题目大意:给定两条直线,判断两条直线共线、平行、相交。若相交,求出交点。 思路:考察叉积的应用。 #include #include #include using namespace std; const int INF = 100010; struct Point { int x, y; }; Poi

c的专栏 577

使用STM32实现简单的语音识别

此外,还需要将计算机的音频输出连接到外部音频放大器上,以便将测试语音播放到MAX9814麦克风模块。运行STM32代码后,系统将开始采集语音数据,并在采集完成后调用Python脚本进行MFCC特征提取。在本案例中,我们将使用STM32F4开发板、MAX9814麦克风模块和MFCC特征提取算法来实现语音识别。通过这个案例,我们可以了解到如何结合STM32开发板和Python实现语音识别,并可以根据需要进行相关扩展和优化。现在,我们可以编译和烧录STM32代码到开发板中,并准备好测试语音文件。

吃不胖. 1473

zzuli 1090 Intersecting Lines(几何问题)

题目链接:http://acm.zzuli.edu.cn/showproblem?problem_id=1090 本题很简单,但不知道为什么,只有一个人做,大意就是求平面内2条直线的关系,a,重合,b,平行,c,相交:此题有一点注意的地方就是,要知道当斜率不存在时注意处理; 代码如下: View Code #include <stdio.h>#include &...

157

RT-DETR训练自己的数据集(从代码下载到实例测试)

在Windows10上配置CUDA环境教程是百度提出的一种实时目标检测模型。RT-DETR采用了与DETR相同的编码器和解码器结构,但对其进行了大量的优化,在保持较高检测精度的同时,实现了实时目标检测,为目标检测领域提供了一种新的有效解决方案,具有广泛的应用前景,如自动驾驶、智能监控、机器人等领域。以上是RT-DETR官方的论文和代码,详细介绍了RT-DETR的构成和实现。在YOLOv10中也实现了RT-DETR的代码,所以本文使用YOLOv10的项目文件进行RT-DETR的训练和测试。YOLOv10。

Limiiiing的博客 4万+

【深度学习】脸部修复,CodeFormer,论文,实战

Blind face restoration是一个高度 ill-posed 的问题,通常需要辅助引导来 1) 改善从降级输入到期望输出的映射,或者 2) 补充在输入中丢失的高质量细节。在本文中,我们展示了在一个小的代理空间中学到的离散码本先验可以通过将盲目的面部恢复建模为 a code prediction task来大大减少恢复映射的不确定性和模糊性,同时为生成高质量面部提供丰富的视觉元素。

q742971636的博客 2991

Intersecting Lines

Intersecting LinesTime Limit: 1000m              Case Time Limit: 30000ms                                   Memory Limit: 10000KB64-bit integer IO format: lld                   Java class name: MainWe...

bxg1065283526的博客 1005

Python 爬虫实战:在丁香医生抓取健康科普文章阅读量,普及健康知识

requests:用于发送 HTTP 请求,获取网页内容。或 lxml:用于解析 HTML 页面,提取目标数据。pandas:用于数据清洗和分析。matplotlib和seaborn:用于数据可视化。通过本项目,我们实现了以下目标:使用 Python 爬虫抓取丁香医生的健康科普文章阅读量。对数据进行清洗和分析,找出热门文章。通过可视化展示数据,并普及健康知识。

u014481728的博客 1566

poj1254Hansel and Grethel poj1269Intersecting_Lines

poj1254Hansel and Grethel #include #include #include using namespace std; const double eps=1e-10; const double pi=acos(-1.0); const int inf=1e8; inline int dcmp(double x){ if(x < eps) return 0

coder_coder_coder的专栏 429

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Intersecting Lines POJ - 1269

http://poj.org/problem?id=1269 叉积真的是计算几何利器 首先对于两条直线(p1 p2) (p3 p4) 若两直线共线 则p3-p1与p2-p1的叉积模为0且p4-p1与p2-p1的叉积模为0 否则 用斜率判一下平行 最后 如果相交求交点 设交点为p0 则p1-p0与p2-p0的叉积模为0p3-p0与p4-p0的叉积模为0 联立后可得a1*x+b1*y+c1...

sunyutian1998的博客 240

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

(计算几何)POJ1269Intersecting Lines

POJ1269Intersecting Lines 题意: 给你两条直线,相交输出交点,重合输出“LINE”,平行输出“NONE”。 思路: 直线相交的模板题,就是在平行和重合的时候可以用叉乘判断。 注意点: 提交G++的时候,不要用%.2lf,要用%.2f。 代码: #include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #include<string.h&

Z7784562的博客 230

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

poj1269 Intersecting Lines

题目描述: vjudge POJ 题解: 直线判交没啥好说的…… (不要用g++,一定要用c++) 代码: #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const dou...

a6t2007的博客 177

POJ 1269 Intersecting Lines

Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16736 Accepted: 7213 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:

Ever_glow的博客 737

【计算几何】POJ 1269 Intersecting Lines

POJ 1269 Intersecting Lines【传送门】 Intersecting Lines Time Limit:1000MS Memory Limit:10000K Total Submissions:20497 Accepted:8658 Description We all know that a pair of disti...

lesileqin的博客 220
上一篇: POJ 2430 Lazy Cows
下一篇: POJ3304 Segments
cmonkey
博客等级 码龄17年 50粉丝 47原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值