题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1332

#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std; const double eps = 1e-;
const double PI = acos(-1.0);
const double INF = 1000000000000000.000; struct Point{
double x,y;
Point(double x=, double y=) : x(x),y(y){ } //构造函数
};
typedef Point Vector; struct Circle{
Point C;
double r; Circle(Point C=Point(,),double r=0.0): C(C),r(r) {}
Point getpoint(double ang){ //可以用来求圆上与x正半轴成ang度的点的坐标。
return Point(C.x +cos(ang)*r,C.y + sin(ang)*r);
}
}; Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}
Vector operator - (Vector A , Vector B){return Vector(A.x-B.x,A.y-B.y);}
Vector operator * (double p,Vector A){return Vector(A.x*p,A.y*p);}
Vector operator / (Vector A , double p){return Vector(A.x/p,A.y/p);} bool operator < (const Point& a,const Point& b){
return a.x < b.x ||( a.x == b.x && a.y < b.y);
} int dcmp(double x){
if(fabs(x) < eps) return ;
else return x < ? - : ;
}
bool operator == (const Point& a, const Point& b){
return dcmp(a.x - b.x) == && dcmp(a.y - b.y) == ;
} ///向量(x,y)的极角用atan2(y,x);
inline double Dot(Vector A, Vector B){ return A.x*B.x + A.y*B.y; }
inline double Length(Vector A) { return sqrt(Dot(A,A)); }
inline double Angle(Vector A, Vector B) { return acos(Dot(A,B) / Length(A) / Length(B)); }
double Cross(Vector A, Vector B) { return A.x*B.y - A.y * B.x; } Vector vecunit(Vector v){ return v / Length(v);} //单位向量 /*************************************分 割 线*****************************************/ const int maxn = ; Circle cir[maxn];
int N;
double R,r; int main()
{
//freopen("E:\\acm\\input.txt","r",stdin);
cin>>N;
for(int i=;i<=N;i++){
scanf("%lf %lf",&cir[i].C.x,&cir[i].C.y);
}
scanf("%lf %lf",&R,&r); if(dcmp(R-r) < ){
printf("0\n");
return ;
} Circle NewC;
NewC.r = R; for(int i=;i<=N;i++){
cir[i].r = r;
}
double ave = *PI / ;
int ans = ;
for(int i=;i<=N;i++){
for(double ang=;ang<=*PI;ang+=ave){
int temp = ;
Point P = cir[i].getpoint(ang); //在圆上取点。 NewC.C = P + R * (cir[i].C-P)/Length(cir[i].C-P); for(int j=;j<=N;j++){
if(i == j) continue;
if(dcmp(fabs(NewC.r-cir[j].r) - Length(NewC.C - cir[j].C)) >= ) {
temp++;
}
}
ans = max(ans,temp);
}
} printf("%d\n",ans);
}

Ural 1332 把圆细分+圆内切,内含关系判定的更多相关文章

  1. bzoj2289: 【POJ Challenge】圆,圆,圆

    Description 1tthinking随便地画了一些圆. ftiasch认为这些圆有交集(面积非零)的可能性不大.因为他实在画了太多圆,所以你被请来判断是否存在交集. Input 第1行,一个整 ...

  2. UVa 10969 (圆与圆之间的覆盖问题) Sweet Dream

    题意: 有n个按先后顺序放置的不同大小不同位置的圆,求所有可见圆弧的长度. 分析: 这道题应该是大白书上例题 LA 2572 (求可见圆盘的数量) Kanazawa 的加强版,整体框架都差不多. 对于 ...

  3. 【BZOJ】2289: 【POJ Challenge】圆,圆,圆

    题解 二分一个横坐标,过这个横坐标做一条和y轴平行的直线,相当于在这条直线上做区间覆盖,如果区间有交的话,那么答案是True 否则的话取两个不相交的区间,如果这两个圆相离或相切则不合法 否则看看相交的 ...

  4. hdu4063(圆与圆交+线段与圆交+最短路)

    写几何题总是提心吊胆.精度问题真心吓人. 其实思路挺简单的一道题,真是什么算法和几何double搞到一块,心里就虚虚的. 思路:求出所有圆之间的交点,然后用这些交点跑一遍最短路就可以了. Aircra ...

  5. 纯CSS圆环与圆

    1. 两个标签的嵌套: <div class="element1"> <div class="child1"></div> ...

  6. hdu 4063 福州赛区网络赛 圆 ****

    画几个图后,知道路径点集一定是起点终点加上圆与圆之间的交点,枚举每两个点之间是否能走,能走则连上线,然后求一遍最短路即可 #include<cstdio> #include<cstd ...

  7. POJ 3549 GSM phone(圆+扫描线+最短路)

    题目意思是求起点s到终点s的最短路,但是只能在圆的内部和边上走.一种可以想到的方法就是求出所有的交点,然后两两连边并验证合法性,但是这样的交点数规模有n2. 我们可以观察发现,我们在圆求并构成的图形中 ...

  8. hdu6354 Everything Has Changed (圆的相交弧长)

    题目传送门 题意: 用一堆圆来切割一个圆心为原点,半径为R的圆A,问切割完毕后圆A外围剩余部分的周长(图中的红线部分). 思路: 首先判定圆与圆A的关系,这题我们只需要与A内切.相交的圆. 然后就是求 ...

  9. HDU-4773 Problem of Apollonius (圆的反演)

    参考: https://oi-wiki.org/geometry/inverse/ https://blog.csdn.net/acdreamers/article/details/16966369 ...

随机推荐

  1. IE str.trim() 不兼容问题解决方法

    本文实例分析了javascript在IE下trim函数无法使用的解决方法: 首先,javascript的trim函数在firefox或者chrome下面使用没有问题: 1 2 3 4 5 <sc ...

  2. C# 基础 知识点

    类型 1.decimal为高精度浮点数,常用于货币计算,然后它不是基本类型,所以性能相对float和double要差. 2.@用于字符串前使转义字符 \  无效,甚至能将回车当作换行符直接赋值给字符串 ...

  3. 连接远程LINUX服务器

    远程登陆linux服务器需要下载一个软件,非常好用,名字是SecureCRT5,百度搜索有很多,如果下载不到可以联系我   运行安装包,一路下一步就可以了   安装好后,运行该软件   点击左上角第二 ...

  4. Eclipse反编译工具Jad及插件

    Eclipse反编译工具Jad及插件下载路径 http://download.csdn.net/detail/lijun7788/9689312 http://files.cnblogs.com/fi ...

  5. 关于java中for和foreach循环

    for循环中的循环条件中的变量只求一次值!具体看最后的图片 foreach语句是java5新增,在遍历数组.集合的时候,foreach拥有不错的性能. foreach是for语句的简化,但是forea ...

  6. Git 基本使用配置

    // 1.配置用户名邮箱:用于记录你个人的用户名称和电子邮件地址,用户名可随意修改,git 用于记录是谁提交了更新,以及更新人的联系方式: $ git config --global user.nam ...

  7. 三十项调整助力 Ubuntu 13.04 更上一层楼

    在Ubuntu 13.04 Raring Ringtail安装完成之后,我们还有三十项调整需要进行. 1.Ubuntu 13.04 Raring Ringtail安装完毕后,我又进行了一系列工作 大家 ...

  8. 弹出对话框 UIAlertController

    双选 //实例化UIAlertController var av=UIAlertController(title: "

  9. Express使用html模板

    express默认使用jade模板,可以配置让其支持使用ejs或html模板. 1. 安装ejs 在项目根目录安装ejs. npm install ejs 2.引入ejs var ejs = requ ...

  10. C#一个字符串的加密与解密

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.S ...