参考了这个博客

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
struct point
{
double x,y;
point(){};
point(double _x,double _y)
{
x=_x,y=_y;
}
}p,q;
struct range
{
double l,r;
bool operator <(const range &a) const
{
return l<a.l;
}
}line[505];
double dist(point a,point b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double r;
int n,t;
int main()
{
while (scanf("%d",&n)!=EOF && n)
{
scanf("%lf%lf",&p.x,&p.y);
for (int i=1;i<=n;i++)
{
scanf("%lf%lf%lf",&q.x,&q.y,&r);
double d=dist(p,q);
double a=asin(r/d),b=asin((p.x-q.x)/d);
// printf("a:%lf b:%lf\n",a,b);
line[i].r=p.x-p.y*tan(b-a);
line[i].l=p.x-p.y*tan(a+b);
// printf("%d : %lf~%lf\n",i,p.y*tan(b-a),p.y*tan(b+a));
}
sort(line+1,line+1+n);
double L=line[1].l,R=line[1].r;
for (int i=2;i<=n;i++)
{
if (line[i].l>R)
{
printf("%.2f %.2f\n",L,R);
L=line[i].l,R=line[i].r;
}
else R=max(R,line[i].r);
}
printf("%.2f %.2f\n\n",L,R);
} return 0;
}

POJ 1375 Intervals | 解析几何的更多相关文章

  1. POJ 1375 Intervals 光源投影【平面几何】

    <题目链接> <转载于> 题目大意: 给一个光源点s,给一些圆,源点和s相切会形成阴影,求每一段阴影在横轴上的区间. 解题分析: 这道其实不需要点与圆切线的板子来求解,完全可以 ...

  2. poj 1375(解析几何)

    Intervals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4292   Accepted: 1288 Descrip ...

  3. poj 1089 Intervals

    http://poj.org/problem?id=1089 Intervals Time Limit: 1000MS   Memory Limit: 10000K Total Submissions ...

  4. poj 1375

    一道解析几何么,,, 其实就是求直线与圆的切线. 看到方法有很多,比如根据角度之类的. 这里主要用到了初中的几何知识. 考虑这幅图. 首先可以根据相似三角形知道b的长度,同时圆心与点的方向也知道. 那 ...

  5. poj 1201 Intervals 解题报告

    Intervals Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Submit Statu ...

  6. POJ 3680 Intervals(费用流)

    Intervals Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 5762   Accepted: 2288 Descrip ...

  7. POJ 1201 Intervals (差分约束系统)

    题意 在区间[0,50000]上有一些整点,并且满足n个约束条件:在区间[ui, vi]上至少有ci个整点,问区间[0, 50000]上至少要有几个整点. 思路 差分约束求最小值.把不等式都转换为&g ...

  8. poj 1201 Intervals(差分约束)

    做的第一道差分约束的题目,思考了一天,终于把差分约束弄懂了O(∩_∩)O哈哈~ 题意(略坑):三元组{ai,bi,ci},表示区间[ai,bi]上至少要有ci个数字相同,其实就是说,在区间[0,500 ...

  9. poj 1201 Intervals(差分约束)

    题目:http://poj.org/problem?id=1201 题意:给定n组数据,每组有ai,bi,ci,要求在区间[ai,bi]内至少找ci个数, 并使得找的数字组成的数组Z的长度最小. #i ...

随机推荐

  1. JS-输入数字输出大写中文

    function(n) { var fraction = ['角', '分']; var digit = [ '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', ...

  2. ES6初识-函数扩展

    默认值 function test(x,y='world'){ console.log('默认值'); } function test2(...arg){ for(let v of arg){ con ...

  3. GUI测试问题汇总

    1.ajax实现的页面元素定位问题 最近在做项目的时候遇到一个问题,通过xpath定位到元素后做一个循环操作,第一循环可以正常执行,第二次循环后就报错,错误信息:Message: The elemen ...

  4. Docker自学纪实(五) 使用Dockerfile构建php网站环境镜像

    一般呢,docker构建镜像容器的方式有两种:一种是pull dockerhub仓库里面的镜像,一种是使用Dockerfile自定义构建镜像. 很多时候,公司要求的镜像并不一定符合dockerhub仓 ...

  5. yarn 无法下载node-sass

    指定node-sass的下载源 yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass

  6. HDU 2222 AC自动机(模版题)

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others ...

  7. C++ 整型长度的获取 不同的系统

    不同的系统中,C++整型变量中的长度位数是不同的,通常,在老式的IBM PC中,int 的位数为16位(与short相同),而在WINDOWS XP,Win7,vax等很多其他的微型计算机中,为32位 ...

  8. opencv中对图像的像素操作

    1.对灰度图像的像素操作: #include<iostream> #include<opencv2/opencv.hpp> using namespace std; using ...

  9. C++机试笔记

  10. [洛谷1156]垃圾陷阱(DP)

    [Luogu1156] f[i]表示高度为i时的存活时间 Code #include <cstdio> #include <algorithm> #define N 110 u ...