Dev.baelanche

[백준 3034] 앵그리 창영 본문

Data Structure & Algorithm/PS - JAVA

[백준 3034] 앵그리 창영

baelanche 2019. 4. 7. 17:39
반응형

 

박스의 가로, 세로 길이가 3, 4 일때 크기 5의 성냥도 들어가는걸로 봐서 성냥을 대각선으로 넣는것도 허용된다.

 

대각선의 길이가 박스내부의 길이 중 가장 크니 피타고라스 공식으로 풀면 된다.

 

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int w = sc.nextInt();
		int h = sc.nextInt();
		
		while(n-->0) {
			int t = sc.nextInt();
			
			int box = (int)Math.sqrt(w*w + h*h);
			if(t <= box)
				System.out.println("DA");
			else System.out.println("NE");
		}
		sc.close();
	}

}
반응형

'Data Structure & Algorithm > PS - JAVA' 카테고리의 다른 글

[백준 1012] 유기농 배추  (0) 2019.04.08
[백준 11724] 연결 요소의 개수  (0) 2019.04.08
[백준 1966] 프린터 큐  (0) 2019.04.06
[백준 2164] 카드2  (0) 2019.04.06
[백준 10845] 큐  (0) 2019.04.06
Comments