**PROBLEM LINK :**

**Probelm Code** : UEMP01

**Panel Members**

Problem Setter:Sintu Kumar

Problem Tester:Sintu Kumar

Contest Admin:Sintu Kumar

**DIFFICULTY**:

EASY

**PREREQUISITES**:

Sample,Input Processing , Basic Mathematics

**PROBLEM**:

A cab owner have N number of cars all are running in city. He give a problem to his one employee.

Cab owner want to check whether a user can book a car or not which is inside or on circle of radious K meter.

If User is at origin position (0,0). N cars position are given in (Xi,Yi) formate. Where 1<=i<=N .

If car can be booked give output as “Available” otherwise “Not Available” .

At that time employee is busy to solve other problem. Can you help him to solve this problem.

**EXPLANATION**:

This is a sample problem you have to find out whether any point lie inside or on the circle of radius k meter. Here user will be always on origin i.e. (0,0) so center of circle will be origin(0,0).

So, Equation of Circle having radius k will be x^2 + y^2 = k^2 .

Lets (Xi,Yi) be position of ith car so if point (Xi,Yi) lie inside or on circle of radius k than it must satisfy the following equation : Xi^2 + Yi^2 <= k^2 .

for any car position(Xi,Yi) of above n cars above equation satisfy than user can book car.Otherwise not be able to book car.

**Basic C++ Code:**

int main() {

int t;

cin>>t;

while(t–){

```
int n,k;
cin>>n;
cin>>k;
bool isPossibleBookCab=false;
for(int i=1;i<=n;i++){
int x,y;
cin>>x>>y;
if((x*x + y*y)<=k*k){
isPossibleBookCab=true;
}
}
```

if(isPossibleBookCab)

```
cout<<"Available"<<endl;
```

else

```
cout<<"Not Available"<<endl;
```

}

return 0;

}

**TIME COMPLEXITY**

O(N)

**SPACE COMPLEXITY**

O(N)