poj 1375(解析几何)
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 4292 | Accepted: 1288 |
Description
Within this model, the x-axis has been aligned with the level of the
floor. The light is considered to be a point light source with integer
co-ordinates [bx,by]. The pipes are represented by circles. The center
of the circle i has the integer co-ordinates [cxi,cyi] and an integer
radius ri. As pipes are made from solid material, circles cannot
overlap. Pipes cannot reflect the light and the light cannot go through
the pipes. You have to write a program which will determine the
non-overlapping intervals on the x-axis where there is, due to the
pipes, no light from the light source.
Input
input consists of blocks of lines, each of which except the last
describes one situation in the basement. The first line of each block
contains a positive integer number N < 500 expressing the number of
pipes. The second line of the block contains two integers bx and by
separated by one space. Each of the next N lines of the block contains
integers cxi, cyi and ri, where cyi + ri < by. Integers in individual
lines are separated by one space. The last block consists of one line
containing n = 0.
Output
output consists of blocks of lines, corresponding to the blocks in the
input(except the last one). One empty line must be put after each block
in the output. Each of the individual lines of the blocks in the output
will contain two real numbers, the endpoints of the interval where there
is no light from the given point light source. The reals are exact to
two decimal places and separated by one space. The intervals are sorted
according to increasing x-coordinate.
Sample Input
6
300 450
70 50 30
120 20 20
270 40 10
250 85 20
220 30 30
380 100 100
1
300 300
300 150 90
1
300 300
390 150 90
0
Sample Output
0.72 78.86
88.50 133.94
181.04 549.93 75.00 525.00 300.00 862.50
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjoAAAFmCAIAAADrjqeGAAAUtklEQVR4nO3dy3kryZEGUBoyK31jBW3QVi7QHrqiDZ2hDWMDZkE2CRD1rnxEZJ2z0m0AmZFVwfgFgLf75QYA4b30LgAA1okrABIQVwAkIK4ASEBcAZCAuAIgAXEFQALiCoAExBUACYgrABIQVwAkIK4ASEBcAZCAuAIgAXEFQALiCoAExBUACYgrABIQVwAkIK4ASEBcAZCAuAIgAXEFQALiCoAExBUACYgrABIQVwAkIK7glI+3l5fX98/eZcDwxBWcsjeuPt9fX94+KhYEgxJXcMqOuPp8f315eXl5EVdwgLiCUzbG1ef769fTPt7EF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IKgATEFQAJiCsAEhBXACQgrgBIQFwBkIC4AiABcQVAAuIKgATEFQAJiCsAEhBXACQgrgBIQFwBkIC4AiABcQVAAuIKgATEFQAJiCsAEhBXACQgrgBIQFwBkIC4AiABcQVAAuIKgATEFQAJiCsAEhBXACQgrgBIQFwBkIC4AiABcQVAAuIKgATEFQAJiCsAEhBXACQgrgBIQFwBkIC4AiABcQVAAuIKgATEFQAJ/D8jo3afJn+bqQAAAABJRU5ErkJggg==" alt="" width="260" height="163" />大概看这个图就能够解除来了。。
这个题距离不能够取绝对值,因为下面这种情况最左边和最右边都要靠p0.x+一个正数
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAAFWCAIAAABmWkqzAAANyUlEQVR4nO3YUXLsNpKG0btJ738p6gdFK65dIotFMkH8iXOeZmKmLQLI/KLaf74AKPDn6Q8A6EleAUrIK0AJeQUoIa8AJeQVoIS8ApSQV4AS8gpQQl4BSsgrQAl5BSghrwAl5BWghLwClJBXgBLyClBCXgFKyCtACXkFKCGvACXkFaCEvAKUkFeAEvIKUEJeAUrIK0AJeQUoIa8AJeQVoIS8ApSQV4AS8gpQQl4BSjTM65//e/pDgKV1a9Cff3v6c4B1tQrQnw1Pfxewolbp+fPnzz//prDAU1p15zuvP//r33lVWGCwbtHZyavIAiN1y83bvCosMEa31mz9u1eFBQbrFpqtnoosMFi3xGw1VGGBwbr1ZSegCguM1C0u+wH1LwqAYbpl5Ug6FRYYoFtTDnZTYYFq3YJyvJvb/56g250Aj+iWkk+LqbBAkW4dOZFLhQUqdIvIuf/Kf+4/BbCjVT52KnkklAoL3KhVOy7mdeefUP3lQD+twrGf14uFFVngI62S8VrD031UWOCiVr24Ma+v/1mFBT7SKhZv83pXYUUWeKtVJn4t4PUsKixwQqtGFOX19R+isMBbrQJxJK+3F1ZkgV+1SsNW9W6socICB7XqwoC8vv7TFBb4VasoHMxrXWFFFvjRKgc7pauIoMICO1q1YHBeX/+xCgv8aBWC43kdUFiRhcW1SsB+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89LrnJRp+Rl7Rd4drfPGBpoZKOxpeRe01AMvdVhmprAn5N3OUq+71GGZnJ+xn8q7l6Xe1RwzG4U9Lu9SVnvU1c7L/PyMPSjvOlZ7ztXOSwSFPSLvLlZ7S+PLtBR2X95FLPiQCx6ZFH7G7si7ggWfcMEjk0Vhf5V3/gXfz9QyP4V9lXf4NR9vzVOTZauwy05s3rHXfLY1T00ihf2Rd+Y132zNUxPKz9hveadd9rWWPTiJFPZLXoMse3ByLV7YvHOu+U5fCx+caCv/jM074Wov9LeVz060NQubd7x13ubVUqNJMwv+jA072CKvsmXx45NutcKGnWqFJ9nnBki3TmHDjtT+Pd5yAzQgrzNq/x5vuQHaaD/MYUdq/x5HLH58Ouk9zGGnklcgRVih5BVIEVaof/7t6c8B2JSX11//Z4DZyCtACXkFKJGXV//uFYgQlleAFPIKUEJeAUrIK0AJeQUoIa8AJeQVoIS8ApSQV4AS8gpQQl4BSsgrQAl5BSghrwAl5BWghLwClJBXgBLyClBCXgFKyCtACXkFKCGvACXkFaCEvAKUkFeAEvIKUEJeAUrIK0AJeQUoIa8AJeQVoIS8ApSQV4AS8gpQQl4BSsgrQAl5BSghrwAl5BWghLwClJBXgBLyClBCXgFKyCtACXkFKCGvACXkFaCEvAKUkFeAEvIKUEJeAUrIK0AJeQUoIa8AJeQVoIS8ApSQV4AS8gpQQl4BSsgrQAl5BSghrwAl/gdH1+LMfrUJJQAAAABJRU5ErkJggg==" alt="" width="221" height="166" />
接下来排个序再合并区间就OK,
#include <iostream>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
using namespace std;
const int N = ;
struct Point {
double x,y,r;
}p[N],p0;
struct Line{
double l,r;
}line[N];
double dis(Point a,Point b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int cmp(Line a,Line b){
if(a.l<b.l) return ;
return ;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF,n){
scanf("%lf%lf",&p0.x,&p0.y);
double angle1,angle2;
for(int i=;i<n;i++){
scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].r);
double l = dis(p[i],p0); ///p0到圆心的距离
angle1 = asin(p[i].r/l);
double len = (p0.x-p[i].x);///这里千万不能够取绝对值..因为后面的有可能是加
angle2 = asin(len/l);
line[i].l = p0.x - p0.y*tan(angle1+angle2);
line[i].r = p0.x - p0.y*tan(angle2-angle1);
}
sort(line,line+n,cmp);
/*for(int i=0;i<n;i++){
printf("%lf %lf\n",line[i].l,line[i].r);
}*/
double l = line[].l,r = line[].r;
for(int i=;i<n;i++){
if(line[i].l>r){
printf("%.2lf %.2lf\n",l,r);
l = line[i].l;
r = line[i].r;
}
else{
r = max(line[i].r,r);
}
}
printf("%.2lf %.2lf\n\n",l,r);
}
return ;
}
poj 1375(解析几何)的更多相关文章
- POJ 1375 Intervals | 解析几何
参考了这个博客 #include<cstdio> #include<algorithm> #include<cstring> #include<cmath&g ...
- poj 1375
一道解析几何么,,, 其实就是求直线与圆的切线. 看到方法有很多,比如根据角度之类的. 这里主要用到了初中的几何知识. 考虑这幅图. 首先可以根据相似三角形知道b的长度,同时圆心与点的方向也知道. 那 ...
- POJ 1375 Intervals 光源投影【平面几何】
<题目链接> <转载于> 题目大意: 给一个光源点s,给一些圆,源点和s相切会形成阴影,求每一段阴影在横轴上的区间. 解题分析: 这道其实不需要点与圆切线的板子来求解,完全可以 ...
- [poj] 1375 Interval || 圆的切线&和直线的交点
原题 每组数据给出一些圆(障碍物)的圆心和半径,一个点和一条线段,求站在这个点,能开到的线段的部分的左端点和右端点.没有则输出"No View" 相当于求过该点的圆的两条切线,切线 ...
- [转] POJ计算几何
转自:http://blog.csdn.net/tyger/article/details/4480029 计算几何题的特点与做题要领:1.大部分不会很难,少部分题目思路很巧妙2.做计算几何题目,模板 ...
- ACM计算几何题目推荐
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面 ...
- CSU训练分类
√√第一部分 基础算法(#10023 除外) 第 1 章 贪心算法 √√#10000 「一本通 1.1 例 1」活动安排 √√#10001 「一本通 1.1 例 2」种树 √√#10002 「一本通 ...
- zoj 1375||poj 1230(贪心)
Pass-Muraille Time Limit: 2 Seconds Memory Limit: 65536 KB In modern day magic shows, passing t ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
随机推荐
- tools.jar seem to ....
android stadio 运行不起来,可以在java_home原来的路径下加一个\, 然后就可以运行起来了.
- 《Cracking the Coding Interview》——第8章:面向对象设计——题目1
2014-04-23 17:32 题目:请设计一个数据结构来模拟一副牌,你要如何用这副牌玩21点呢? 解法:说实话,扑克牌的花样在于各种花色.顺子.连对.三带一.炸弹等等,如果能设计一个数据结构,让判 ...
- SecureCRT自动登录跳板机/堡垒机并连接目标机器
公司登录目标服务器,需要先登录跳板机(堡垒机),然后再登录目标机器,一共需要4.5步. MAC或LINUX机器可以写.SH脚本,那WINDOWS有没有一键登陆的方法呢? 常用的SecureCRT工具就 ...
- 四 Android Capabilities讲解
本文转自:http://www.cnblogs.com/sundalian/p/5629429.html Android Capabilities讲解 1.Capabilities介绍 可以看下之 ...
- Linux - Shell - 常用方法 - 备忘录
$? 上一个指令的返回值 =成功,=失败 dmesg 检测系统开机启动信息 $() 对命令的替换,同`` ${} 对变量的替换,同$var $(()) 对内部内容进行整数运算 i= grep AAA ...
- websocket+nodejs+redis实现消息订阅和发布系统
其实我很懒,不想打字,代码已上传到码云,请点此处. 有疑问请一下扫描二维码,加我微信:
- 孤荷凌寒自学python第五十天第一次接触NoSql数据库_Firebase
孤荷凌寒自学python第五十天第一次接触NoSql数据库_Firebase (完整学习过程屏幕记录视频地址在文末) 之前对关系型数据库的学习告一段落,虽然能力所限没有能够完全完成理想中的所有数据库操 ...
- .export*读取图片
*读取图片 read_image(Image,'D:/MyFile/halcon/数字识别/1.jpg define PHYS_FLASH2_1 0xBC000000 /* Image2 Bank # ...
- gulp-API介绍
使用gulp,一般只需要用4个API:gulp.src(),gulp.dest(),gulp.task(),gulp.watch(). 1. gulp.src() 用来获取流的,但是要注意的是这个流里 ...
- 一个自动安装LNMP的简洁Shell脚本
此脚本在生产服务器上使用了一年多,本脚本崇尚简单唯美,只需要一个脚本就可以在任何一台有网络的服务器上自动配置LNMP.本脚本会在脚本执行目录下,建packages目录用于存放LNMP所需要的软件.大家 ...