您当前的位置: 首页 > 

钟钟终

暂无认证

  • 0浏览

    0关注

    233博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

第二周--贪心题解(C)

钟钟终 发布时间:2021-03-16 16:46:34 ,浏览量:0

题C:

Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can only cover d distance, so an island in the sea can be covered by a radius installation, if the distance between them is at most d.

We use Cartesian coordinate system, defining the coasting is the x-axis. The sea side is above x-axis, and the land side below. Given the position of each island in the sea, and given the distance of the coverage of the radar installation, your task is to write a program to find the minimal number of radar installations to cover all the islands. Note that the position of an island is represented by its x-y coordinates.

Figure A Sample Input of Radar Installations

Input The input consists of several test cases. The first line of each case contains two integers n (1d&&n!=0&&d!=0) { int sum=1; for(int i=0;i>a[i].x>>a[i].y; if(a[i].y>d||d

关注
打赏
1664378814
查看更多评论
立即登录/注册

微信扫码登录

0.0403s