POJ 2036 I Conduit!

hdoj2036 c语言实现(任意多边形的面积 #include <stdio.h> #include <stdlib.h>int main() { int n; int x[1000]; int y[1000]; while(scanf("%d",&n)&&n!=0) { int sum=0; double ans=0; for(int i=1;i<=n; 阅读详情

 

I Conduit!
Time Limit: 2000MS Memory Limit: 30000K
Total Submissions: 1313 Accepted: 245

Description

Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people's yards. Irv's job is to make sure that no underground pipe or cable is underneath where excavation is planned. He has several different maps, one for each utility company, showing where their conduits lie, and he needs to draw one large, consolidated map combining them all. One approach would be to simply draw each of the smaller maps one at a time onto the large map. However, this often wastes time, not to mention ink for the pen-plotter in the office, since in many cases portions of the conduits overlap with each other (albeit at different depths underground). What Irv wants is a way to determine the minimum number of line segments to draw given all the line segments from the separate maps.

Input

Input will consist of multiple input sets. Each set will start with a single line containing a positive integer n indicating the total number of line segments from all the smaller maps. Each of the next n lines will contain a description of one segment in the format

x1 y1 x2 y2

where (x1,y1) are the coordinates of one endpoint and (x2,y2) are the coordinates of the other. Coordinate values are floating point values in the range 0...1000 speci.ed to at most two decimal places. The maximum number of line segments will be 10000 and all segments will have non-zero length. Following the last input set there will be a line containing a 0 indicating end of input; it should not be processed.

Output

For each input set, output on a single line the minimum number of line segments that need to be drawn on the larger, consolidated map.

Sample Input

3
1.0 10.0 3.0 14.0
0.0 0.0 20.0 20.0
10.0 28.0 2.0 12.0
2
0.0 0.0 1.0 1.0
1.0 1.0 2.15 2.15
2
0.0 0.0 1.0 1.0
1.0 1.0 2.15 2.16
0

Sample Output

2
1
2

Source

 

 

 

『杭电1352』I Conduit! Problem Description Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people’s yards. Irv’s job is to make sure that no underground pipe or cable is underneath where excavation is planned. He has several di 阅读详情

相关推荐

华为2019秋招笔试Java实现(2)

华为2019秋招笔试Java实现(2) 笔试日期2019年8月14日 第二题(200分) 题目描述 某程序员小A,有一种表格数据需要存储在文件中。表格中的每一行,由若干个字段组成,每个字段可以是整数或字符串(字符串只包含数字、字母以及特殊字符!@#%^&*()",)。小A设计了一种存储格式,采用文本的方式对表格数据进行存储。文本文件中的每一行,代表了表格数据中的一行数据。具体格式描述如下: 1、采用逗号分隔不同的字段(逗号前后无空格); 2、数字直接采用10进制的文本存储; 3、字符串的存储规则如下

hewhys的博客 1549

Sicily.1004. I Conduit!

/*1004. I Conduit! 题目大意:给出一堆线段,求出需要画出最少的直线就可覆盖全部线段 即有一部分重叠的线段用一条直线代表即可。 思路:先对每条线段求出其斜率k和截距b(如果没有截距,则用无限大代表) 然后记录每条线段的起始位置(如果无斜率则为y坐标的较小的那个,如果 有斜率,则为

xiehaoyun2012的专栏 1079

深入解析Cuk、Zeta和Sepic拓扑:非隔离型开关电源的设计奥秘

本文深入解析了Cuk、Zeta和Sepic三种非隔离型开关电源拓扑的设计奥秘。它们均能实现升降压转换,但特性各异:Cuk拓扑输出反向电压,输入输出纹波极低;Sepic拓扑输出同极性电压,应用广泛;Zeta拓扑输出纹波小,适合精密供电。文章详细对比了其电路结构、工作原理、核心公式及选型指南,帮助工程师根据输入电压范围、输出极性及纹波要求,灵活选择最合适的拓扑方案。

weixin_28308325的博客 476

POJ 2036 I Conduit! 笔记

n段线段,给出线段的端点坐标。重新绘制最少需画多少线段。

woniupengpeng的专栏 360

基于强化学习的工业SCR脱硝系统控制算法设计与实现

本文提出了一种基于强化学习的工业SCR脱硝系统智能控制方法。针对SCR系统存在的非线性、大滞后和多变量耦合等控制难点,研究采用混合建模方法构建了精度在5%以内的系统模型,并设计了专门的强化学习环境。该方法通过定义合理的动作空间和状态空间,结合物理约束设计损失函数,利用深度强化学习算法优化氨喷射控制策略。相比传统PID控制,该智能控制器能更好地适应烟气参数波动,实现NOx排放的稳定控制,为工业环保设施提供了更优的自动化解决方案。

huanghm88的专栏 1456

5分钟搞定Unity+Visual Studio开发环境配置(含C#游戏开发工作负载)

本文提供了一份详细的Unity与Visual Studio开发环境配置指南,帮助开发者在5分钟内完成C#游戏开发工作负载的设置。从Unity Hub安装到Visual Studio关键组件选择,再到常见问题排查,全面覆盖环境搭建的各个环节,显著提升游戏开发效率。

weixin_29014237的博客 248

SOJ 1004

1004. I Conduit! Constraints Time Limit: 3 secs, Memory Limit: 32 MB Description Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people'

Tsinting的博客 500

Android15 AndroidV冻结和解冻的场景

cgroup 最初由 Google 工程师 Paul Menage 和 Rohit Seth 在 2006 年提出,是一种细粒度资源控制的Linux内核机制。于 2007 年合并到 Linux 内核主线中。然而 Google 原生系统直到 Android 11 或更高版本上才支持 CACHE 应用的 CPU 冻结功能。当应用切换到后台并且没有其他活动时,系统会在一定时间内通过状态判断,将进程 ID 迁移到冻结的 cgroup 节点上,实现冻结 CACHE 应用。

苏法迪的专栏 1786

Sicily 1004. I Conduit!

1004. I Conduit! Constraints Time Limit: 3 secs, Memory Limit: 32 MB Description Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people'

Nightonke's Blog 803

Python分布式爬虫深度实战:反爬破解+数据清洗+性能优化全流程

分布式爬虫的核心是“调度中心化+执行分布式”,Scrapy-Redis是最易落地的框架,无需从零写调度逻辑;反爬破解要分级应对:基础反爬靠随机UA/限流,进阶反爬靠代理池,高级反爬靠第三方验证码API;数据清洗的关键是“批量处理+标准化”,避免内存溢出,核心字段去重和异常值过滤是必做步骤;性能优化不是单纯加节点,而是从架构(分片)、代码(批量写入)、服务器(索引/网络)三层协同优化,才能实现效率翻倍。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1200

Dify 第 19 篇 手把手教你开发 Dify 插件:从零实现一个时间工具

本文介绍了Dify平台的插件开发机制和流程。Dify支持多种插件类型,包括模型、工具、数据源等,可通过CLI工具快速开发插件。文章详细讲解了如何安装Dify CLI工具,并演示了从零开发一个获取系统时间插件的完整过程,包括项目初始化、文件解读和打包部署。通过该教程,开发者可以快速掌握Dify插件开发的核心要点,实现自定义功能扩展。

甘蓝的专栏 2447

sicily 1004.I Conduit!

1004. I Conduit! Constraints Time Limit: 3 secs, Memory Limit: 32 MB Description Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people'

yuhao199555的博客 979

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

1004. I Conduit!

soj.me/1004 依次排序好k,b,x1,y1 注意斜率不存在的情况 #include #include #include using namespace std; const double MAX=999999;//自定义无穷大斜率 class segment { public: double k,b,x1,y1,x2,y2;//使用斜截式表示线段

[Q]4EchoNStef 1707

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

POJ 2036 Wireless Network

An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n

MrQ_zh的博客 368

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

sicily 1004 I Conduit!

Description Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people's yards. Irv's job is to make sure that no underground pipe or cable is under...

anhong585258的博客 230

HDUOJ2036——任意多边形求面积问题

  任意多边形求面积问题   Input 输入数据包含多个测试实例,每个测试实例占一行,每行的开始是一个整数n(3&lt;=n&lt;=100),它表示多边形的边数(当然也是顶点数),然后是按照逆时针顺序给出的n个顶点的坐标(x1, y1, x2, y2... xn, yn),为了简化问题,这里的所有坐标都用整数表示。 输入数据中所有的整数都在32位整数范围内,n=0表示数...

光阴跑走的博客 521

1004: I Conduit!

  Q1004: I Conduit!—问题描述Irv Kenneth Diggit在一家挖掘沟渠的公司工作,公司在钻孔时经常会损坏居民的生活设施,Irv 的工作就是保证在计划挖掘的地方之下不会有地下管道或是电缆。他有一些不同的地图,每张对应一家设施公司,显示其管道的分布。他希望能绘制一张大一些的地图,将这些不同地图组合起来。一种做法是简单地在大地图上依次绘制每一张小地图。然而,这往往

忽若流星的专栏 1368

i conduct

I Conduit! ConstraintsTime Limit: 3 secs, Memory Limit: 32 MBDescriptionIrv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people’s yards. Irv’s job is to

stary_yan的博客 713

hdu 1352 I Conduit!

计算几何,主要是排序问题,其他都很好做…… #include<iostream>#include<stdio.h>#include<algorithm>#include<iomanip>#include<cmath>#include<string>using namespace std;struct seg{ doub...

weixin_30376323的博客 137

HDU 1352(I Conduit!)

题目不难,但是对精度要求很高,所以 double 类型不能直接比较大小,需要借助一个趋于零的正数(如 1e-8)比较。 #include <iostream> #include <algorithm> #include <cmath> using namespace std; const int MAXN = 10005; struct segment /...

Intelligence1028的博客 228

【ACM】杭电OJ 2036(待更)

AC代码  #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;cmath&gt; #include &lt;cstdlib&gt; #include &lt;set&gt; #include &lt;algorithm&gt; using namespace std;

( :3 ) 347

改革春风吹满地(hdu2036)(三角形的面积)(叉乘)

第一种解法:将三角形化为梯形面积减去两个三角形面积无论三角形的顶点位置如何,△PMN总可以用一个直角梯形(或矩形)和两个直角三角形面积的和差来表示而在直角坐标系中,已知直角梯形和直角三角形的顶点的坐标,其面积是比较好求的。下面以一种情形来说明这个方法,其它情形方法一样,表达式也一样(表达式最好加上绝对值,确保是正值)如图情形(P在上方,M在左下,N在右下),过P作X轴的平行线L,作MA⊥L,NB⊥...

肘子的博客 2065

POJ 1127 Jack Straws

 Jack StrawsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1824 Accepted: 817DescriptionIn the game of Jack Straws, a number of plastic or wooden "st

bobten2008的专栏 2178
上一篇: POJ 2030 The Secret Number
下一篇: POJ 2044 Weather Forecast
bobten2008
博客等级 码龄18年 153粉丝 157原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值