Algorithms63 백준 3034. 앵그리 창영 굉장히 쉬웠던 문제 ! 박스 바닥의 대각선 길이보다 성냥이 길면 안되므로 피타고라스를 써서 비교해주자. from math import sqrt n, w, h = map(int, input().split()) l = sqrt(w**2 + h**2) for _ in range(n): test = int(input()) if test 2022. 6. 9. 백준 4153. 직각삼각형 걍.. 쉽다. 피타고라스 정리 때려보기. while True: lst = list(map(int, input().split())) lst.sort() if lst[0] == lst[1] == lst[2] == 0: break if lst[0]**2 + lst[1]**2 == lst[2]**2: print("right") else: print("wrong") 사진 삭제 사진 설명을 입력하세요. 2022. 6. 9. 백준 3009. 네 번째 점 뭔가 바로 해결책이 떠오르지 않았던 문제. 살짝 고민했으나, 세 점 중에서 두 번 등장한 점은 이미 이어져 있는 것이므로, 한 번만 등장한 좌표들을 체크해서 출력할 생각을 해봤다. dic_x = {} dic_y = {} for i in range(3): x, y = map(int, input().split()) if dic_x.get(x) == None: dic_x[x] = 1 else: dic_x[x] += 1 if dic_y.get(y) == None: dic_y[y] = 1 else: dic_y[y] += 1 for i in dic_x.keys(): if dic_x[i] == 1: print(i, end=" ") for j in dic_y.keys(): if dic_y[j] == 1: print(j) 2022. 6. 9. 백준 1085. 직사각형에서 탈출 생각보다 매우 간단했던 문제! 단순히 현재 좌표에서 직사각형의 변쪽으로 가는 거리를 구하면 된다. 이는 단순 xy에 국한되므로, 상하좌우의 거리를 구해서 그 중 최솟값을 찾아주면 된다. x, y, w, h = map(int, input().split()) print(min(w - x, x, y, h - y)) 2022. 6. 9. 이전 1 ··· 8 9 10 11 12 13 14 ··· 16 다음