์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ/BOJ_Python

[BOJ/Step9] 3009 : ๋„ค ๋ฒˆ์งธ ์  (Python)

NaNaRin๐Ÿ™ƒ 2021. 2. 15. 18:42

www.acmicpc.net/problem/3009

 

3009๋ฒˆ: ๋„ค ๋ฒˆ์งธ ์ 

์„ธ ์ ์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ์ถ•์— ํ‰ํ–‰ํ•œ ์ง์‚ฌ๊ฐํ˜•์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ ํ•„์š”ํ•œ ๋„ค ๋ฒˆ์งธ ์ ์„ ์ฐพ๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

www.acmicpc.net


1. ์„ธ ์ ์ด ์ฃผ์–ด์กŒ๋Š”๋ฐ ํ•œ ์ ์„ ์ฐ์Œ์œผ๋กœ์„œ ํ•ญ์ƒ ์ง์‚ฌ๊ฐํ˜•์ด ๋งŒ๋“ค์–ด์ง„๋‹ค๋Š” ๊ฑด, ์ฃผ์–ด์ง€๋Š” ์„ธ ์ ์ด ๋ฌด์กฐ๊ฑด ์ง๊ฐ์œผ๋กœ ์ฃผ์–ด์ง„๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. 

2. ์ฃผ์–ด์ง„ ์„ธ ์ ์€ x๋ผ๋ฆฌ, y๋ผ๋ฆฌ ๋ฌถ์—ˆ์„ ๋•Œ ๋‘ ๊ฐœ๋Š” ๊ฐ™๊ณ  ํ•œ ๊ฐœ๋Š” ๋‹ค๋ฅผ ๊ฒƒ์ด๋‹ค. ๋‹ค๋ฅธ ํ•œ ๊ฐœ๋ฅผ ๋ชจ์•„ ๋„ค๋ฒˆ์งธ ์ ์„ ๋งŒ๋“ค์–ด ์ฃผ๋ฉด ๋œ๋‹ค.

# 3009.py

x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
x3, y3 = map(int, input().split())

x4 = x1 if x2 == x3 else x2 if x1 == x3 else x3
y4 = y1 if y2 == y3 else y2 if y1 == y3 else y3

print(x4, y4)