BOJ/백준-3009-python

cosmos·2021년 2월 23일
4
post-thumbnail

문제📖

풀이🙏

  • 세 점의 좌표가 한 줄에 하나씩 주어진다.
  • 축에 평행한 직사각형을 만들기 위해 필요한 네 번째 점의 좌표를 출력하라.
    -> list + for 반복문 + if 조건문 + 내장 함수 countlist내의 개수가 한 개인 점을 찾아 출력한다.

코드💻

# boj, 3009 : 네 번째 점, python3
import sys

x_list = []
y_list = []

for _ in range(3):
    x, y = map(int,sys.stdin.readline().split())
    x_list.append(x)
    y_list.append(y)

for i in x_list:
    if x_list.count(i) == 1:
        result_x = i
for i in y_list:
    if y_list.count(i) == 1:
        result_y = i
        
print(result_x, result_y)

결과😎

출처 && 깃허브📝

https://www.acmicpc.net/problem/3009
github

0개의 댓글