어디가 문제인지 모르겠습니다...

jaho97 Reply 7 years 9 weeks ago
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); double x1 = input.nextDouble(); double y1 = input.nextDouble(); double w1 = input.nextDouble(); double h1 = input.nextDouble(); double x2 = input.nextDouble(); double y2 = input.nextDouble(); double w2 = input.nextDouble(); double h2 = input.nextDouble(); double Lx = Math.abs(x1 - x2); double Ly = Math.abs(y1 - y2); if (Lx > (w1 + w2)/2) { System.out.print("outside"); } else if (Ly > (h1 + h2)/2) { System.out.print("outside"); } else if (Lx + w2/2 < w1/2 && Ly + h2/2 < h1/2) { System.out.print("inside"); } else { System.out.print("attach"); } } } 조건도 다 만족하게 했는데 왜 안되는지 모르겠습니다.
jaho97 Reply 7 years 9 weeks ago
두개의 사각형 문제입니다
jaho97 Reply 7 years 9 weeks ago
해결했습니다
withcs1 Reply 7 years 9 weeks ago
축하해요!