POJ1328
来源:互联网 发布:web前端性能优化方法 编辑:程序博客网 时间:2024/06/08 08:32
#include <cstdio>#include <cstring>#include <algorithm>#include <queue>#include <cmath>#include <set>#include <iostream>const double PI=acos(-1.0);using namespace std;typedef long long ll;struct node{ int x,y; double l,r;}isl[1005];double radar[1005];bool cmp(node a,node b){ return a.x<b.x;}int main(){ int n,d,cas=1; while(~scanf("%d%d",&n,&d)&&n&&d) { int fflag=0; for(int i=0;i<n;i++) { scanf("%d%d",&isl[i].x,&isl[i].y); if(isl[i].y>d||-1*isl[i].y<-d) { fflag=1; } double ll=sqrt(d*d*1.0-isl[i].y*isl[i].y); isl[i].l=isl[i].x-ll; isl[i].r=isl[i].x+ll; } if(fflag==1) { printf("Case %d: -1\n",cas++); continue; } sort(isl,isl+n,cmp); double place; int ans=1; place=isl[0].r; for(int i=1;i<n;i++) { if(isl[i].l>place) { ans++; place=isl[i].r; } else if(isl[i].r<place) { place=isl[i].r; } } printf("Case %d: %d\n",cas++,ans); } return 0;}
0 0
- POJ1328
- poj1328
- POJ1328
- poj1328
- POJ1328
- poj1328
- poj1328
- poj1328
- poj1328
- poj1328
- poj1328
- poj1328
- poj1328
- POJ1328
- POJ1328
- POJ1328
- poj1328
- POJ1328
- java并发编程之CountDownLatch
- 漫步微积分七——连续函数
- ADB常用命令介绍
- js操作字符串的常见方法
- Spring中基于Java的配置@Configuration和@Bean用法
- POJ1328
- 解密:德国“工匠精神”造就“隐形冠军”
- Oracle Spatial空间类型
- 按照列表中的某个字段的属性进行排序
- S5PV210 nand flash 驱动移植
- iOS中的round/ceil/floorf函数略解
- jsoup eg
- hd 1280 前m大的数
- spring中AOP编程