본문 바로가기
Algorithm/etc

[파이썬] 백준 - 10단계 기하: 직사각형과 삼각형

by 베짱이28호 2023. 4. 8.

[파이썬] 백준 - 10단계 기하: 직사각형과 삼각형

 


직사각형 (27323)

A = int(input())
B = int(input())
print(A*B)

직사각형에서 탈출 (1085)

x,y,w,h = map(int,input().split())
temp = [x,y,w-x,h-y]
print(min(temp))

네 번째 점 (3009)

temp_x,temp_y = set({}),set({})
given,point = [],[]
for i in range(3):
    x,y = map(int,input().split())
    temp_x.add(x)
    temp_y.add(y)
    given.append([x,y])

temp_x = list(temp_x)
temp_y = list(temp_y)
x_min,x_max,y_min,y_max = min(temp_x),max(temp_x),min(temp_y),max(temp_y)

for i in temp_x:
    for j in temp_y:
        point.append([i,j])

for i in range(3):
    point.remove(given[i])
print(point[0][0],point[0][1])

주어진 좌표값으로 부터 점 4개를 만들고 주어진 좌표 3개를 빼서 남은 하나 구하기


수학은 체육과목 입니다 (15894)

n = int(input())
print(n*4)

 


대지 (9063)

N = int(input())
x_point = []
y_point = []
for i in range(N):
    x,y = map(int,input().split())
    x_point.append(x)
    y_point.append(y)
area = (max(x_point)-min(x_point)) * (max(y_point)-min(y_point))
print(area)

 


삼각형 외우기 (10101)

temp = []
for i in range(3):
    angle = int(input())
    temp.append(angle)

if sum(temp) != 180:
    print('Error')
else :
    if (temp[0]==temp[1]) and (temp[0]==temp[2]) :
        print('Equilateral')
    elif (temp[1]==temp[2]) or (temp[0]==temp[1]) or (temp[2]==temp[0]) :
        print('Isosceles')
    else : 
        print('Scalene')

삼각형과 세 변 (5073)

while True:
    temp = list(map(int,input().split()))
    temp.sort()
    
    if temp == [0,0,0] :
        break
    else : 
        if temp[0] + temp[1] <= temp[2] :
            print('Invalid')
        elif (temp[0] == temp[1]) and (temp[0] == temp[2]) :
            print('Equilateral')
        elif (temp[0] == temp[1]) or (temp[1] == temp[2]) or (temp[2] == temp[0]) :
            print('Isosceles')
        else :
            print('Scalene')

세 막대 (14215)

temp = list(map(int,input().split()))
temp.sort()
if temp[0]+temp[1] <= temp[2] :
    answer = temp[0]+temp[1] + (temp[0]+temp[1]-1)
else :
    answer = temp[0]+temp[1]+temp[2]
print(answer)

작은거 두 변 기준으로 정하고 남은 변 조건따라 출력

댓글