全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
解题报告:Phone numbers题目来源: No.1039解法或类型:枚举作者:梁 举 PipeTime Limit:1S Memory Limit:1000KTotal Submit:124 Accepted:36Description The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape the company ran into the problem of determining how far the light can reach inside each component of the pipe. Note that the material which the pipe is made from is not transparent and not light reflecting. Each pipe component consists of many straight pipes connected tightly together. For the programming purposes, the company developed the description of each component as a sequence of points x1; y1, x2; y2, . . ., xn; yn, where x1 x2 . . . xn . These are the upper points of the pipe contour. The bottom points of the pipe contour consist of points with y-coordinate decreased by 1. To each upper point xi; yi there is a corresponding bottom point xi; (yi)-1 (see picture above). The company wants to find, for each pipe component, the point with maximal x-coordinate that the light will reach. The light is emitted by a segment source with endpoints x1; (y1)-1 and x1; y1 (endpoints are emitting light too). Assume that the light is not bent at the pipe bent points and the bent points do not stop the light beam. Input The input file contains several blocks each describing one pipe component. Each block starts with the number of bent points 2 = n = 20 on separate line. Each of the next n lines contains a pair of real values xi, yi separated by space. The last block is denoted with n = 0. Output The output file contains lines corresponding to blocks in input file. To each block in the input file there is one line in the output file. Each such line contains either a real value, written with precision of two decimal places, or the message Through all the pipe. The real value is the desired maximal x-coordinate of the point where the light can reach from the source for corresponding pipe component. If this value equals to xn, then the message Through all the pipe. will appear in the output file. Sample Input 40 12 24 16 460 12 -0.65 -4.457 -5.5712 -10.817 -16.550Sample Output 4.67Through all the pipe.Source Central Europe 1995解题思路:题目要我们求出光线在Pipe里能射到的最远处的x坐标。我们只要找出其中一条最优光线。一条最优光线必须满足的一个必要条件是:它必定过Pipe的一个上顶点和一个下顶点。否则,我们总可以通过平移或是旋转使光线走更远的距离。有了这个条件,就可以通过枚举所有的上下顶点对(i,j),找出最优的。过上下顶点的光线共有n*n条,要求的就是MaxX(i,j) | 过上下顶点对(i,j)能达到的最远距离的横坐标 (i=0.n-1,j=0.n-1;)光线(i,j)要能进入了k-1到k这一节,则它比与(0,0).(k-1,k-1)都相交。并且当(i,j)与(0,0).(k-1,k-1)都相交,而与(k,k)不交时,他必与上边或下边(k-1,k)相交。显然当kMax(i,j),求出(i,j)与上/下边(k-1,k)的交点的x坐标,并与当前最大值比较,决定取舍。在判断(i,j)与(k,k)(k=0,1,.)的交点时,可以直接求出他们所在直线的纵坐标来决定。(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 人防材料仓储管理员操作规程
- 2026年注册安全工程师考试真题及答案
- 2026年驾照三力测试试题题库及答案
- 传染病密接健康监测记录模板标准共识
- 2025-2026学年广东省茂名市初中政治八年级期末上册评估冲刺押宝题(附答案)
- Oracle并发机制高频面试题(含详细实战答案)
- 2026年全科医生笔试试题及答案
- 厂房中央除尘系统管道安装施工方案
- 水上施工临时用电安全规程
- NUS本科入学笔试真题及详细参考答案(版)
- DB62-T 5072-2024 公路固废基胶凝材料稳定碎石混合料 设计与施工规范
- 嘉兴海宁华数广电网络有限公司招聘笔试冲刺题2025
- 学习劳模精神我心中的劳模榜样课件讲解
- 宠物犬鉴赏与疾病防治(石河子大学)知到智慧树章节答案
- 科室新技术和新项目开展情况登记本
- 矿产资源储量报告编制和评审中常见问题及其处理意见
- 二手房买卖合同范本下载可打印
- 《西式烹饪工艺》课件-炸薯条
- 工业设计专业职业生涯规划
- 青岛版 小学 信息技术 四年级下册 课程纲要 学历案
- 人教版四年级上册语文《古诗三首》练习题(含答案)
评论
0/150
提交评论