Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package inHourExercise;
- import java.util.Scanner;
- public class Circle {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] inputCircle = scanner.nextLine().split(",|=");
- double x = Double.parseDouble(inputCircle[1]);
- double y = Double.parseDouble(inputCircle[3]);
- double r = Double.parseDouble(inputCircle[5]);
- while (true){
- String[] inputPoint = scanner.nextLine().split(",|=");
- if (inputPoint[0].equals("OVER")){
- break;
- }
- double pointX = Double.parseDouble(inputPoint[1]);
- double pointY = Double.parseDouble(inputPoint[3]);
- double dist = Math.sqrt((x - pointX) * (x - pointX) + (y - pointY) * (y - pointY));
- if (Math.abs(r - dist) < 0.1){ //dist == r
- System.out.println("Border");
- }else if (dist < r){
- System.out.println("Inside");
- }else {
- System.out.println("Outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement