1328
#include<iostream>
#include<cmath>

using namespace std;

const int MAX = 1001;
const int X = 0;
const int Y = 1;

int N = 0;
int D = 0;

double getX(int d, int y);
void quick_sort(double array[MAX][2], int l, int r);

int main()
{

freopen("input.txt", "r", stdin);
setbuf(stdout, NULL);

int test_case = 0;
bool over = false;
int answer = 0;

while(true)
{

cin >> N >> D;
if(N == 0 && D == 0)
{
break;
}

double Radius[MAX][2] = {0};

test_case++;
over = false;

int x, y;
for(int i = 0; i < N; i++)
{
cin >> x >> y;
if(y > D)
{
over = true;
}
if(over != true)
{
double z = getX(D, y);
Radius[i][X] = x - z;
Radius[i][Y] = x + z;
}
}

if(over == true)
{
cout << "Case " << test_case << ": " << -1 <<endl;
continue;
}

quick_sort(Radius, 0, N - 1);

double right = Radius[0][Y];

for(int i = 1; i < N; i++)
{
{
}
else if(Radius[i][Y] < right)
{
}
}
cout << "Case " << test_case << ": " << answer <<endl;
}

return 0;
}

double getX(int d, int y)
{
return sqrt((double)(d * d * 1.0 - y * y * 1.0));
}
void quick_sort(double array[MAX][2], int l, int r)
{
if(l < r)
{
int i = l;
int j = r;
double x = array[l][X];
double y = array[l][Y];
while(i < j)
{
while(i < j && array[j][X] > x)
j--;
if(i < j)
{
array[i][X] = array[j][X];
array[i][Y] = array[j][Y];
i++;
}
while(i < j && array[i][X] < x)
i++;
if(i < j)
{
array[j][X] = array[i][X];
array[j][Y] = array[i][Y];
j--;
}
}
array[i][X] = x;
array[i][Y] = y;

quick_sort(array, l, i - 1);
quick_sort(array, i + 1, r);
}
}

2016-12-13 17:00:23

北大1328题

2008-11-14 18:16:00

UVA 1328 Period(KMP:最短循环节)

2014-04-04 10:54:28

hdu1328——IBM Minus One

2013-03-31 00:37:18

POJ:1328 Radar Installation 思路以及测试数据

2016-08-22 17:16:38

hrubst 1328

2014-11-10 15:07:23

2015-05-27 15:32:24

poj1328 Radar Installation 贪心 （手动翻译）

2016-01-25 11:03:44

POJ 1328 Radar Installation-放置雷达（贪心，区间，二维转一维）

2014-11-11 11:44:34

ISO 1328-1 Cylindrical gears-ISO system of accuracy-Part 1(代替 UNI 7880).pdf

2010年07月30日 968KB 下载

1328