Dog+and+Gopher

Source Code code format="java5"

import java.util.Scanner;

public class DogAndGopher { private static int AMOUNT_OF_FASTER = 2; private static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); while(scan.hasNext) { int n = scan.nextInt; // ������ ����

double gx = scan.nextDouble; // ���ٶ����� X��ǥ double gy = scan.nextDouble; // ���ٶ����� Y��ǥ

double dx = scan.nextDouble; // ���� X��ǥ double dy = scan.nextDouble; // ���� Y��ǥ process(n, gx, gy, dx, dy); }   }    // ������ Ǭ��. public static void process(int n, double gx, double gy, double dx, double dy) { for (int i = 0; i < n; i++) { double hx = scan.nextDouble; // ������ X��ǥ double hy = scan.nextDouble; // ������ Y��ǥ

if (getDistance(gx, gy, hx, hy) * AMOUNT_OF_FASTER <= getDistance(dx, dy, hx, hy)) { System.out.printf("The gopher can escape through the hole at (%f, %f).\n", hx, hy); return; }   }    System.out.println("The gopher cannot escape."); }

// �� ���� ������ �Ÿ��� ���Ѵ�. // ��Ÿ��� ������ �̿��Ѵ�. public static double getDistance(double x1, double y1, double x2, double y2) { return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); }   }

code