[BOJ] 5597. ๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..?

๋ฌธ์ œ

Baekjoon Online Judge
Baekjoon Online Judge

BOJ #5597. ๊ณผ์ œ ์•ˆ ๋‚ด์‹  ๋ถ„..?

SOLVED.AC Bronze V


Python ์ฝ”๋“œ

'o'๋ผ๋Š” ๋ฆฌ์ŠคํŠธ์— for๋ฌธ์„ ์ด์šฉํ•˜์—ฌ 1๋ถ€ํ„ฐ 30๊นŒ์ง€๋ฅผ ์ „๋ถ€ ์ž…๋ ฅํ•˜๊ณ ,

'l'์ด๋ผ๋Š” ๋ฆฌ์ŠคํŠธ์— 28๊ฐœ์˜ ์ž…๋ ฅ์„ ๋ฐ›์€ ๋’ค,

'o' ๋ฆฌ์ŠคํŠธ์™€ 'l' ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ฐ๊ฐ 'so'์™€ 'sl'์ด๋ผ๋Š” ์ด๋ฆ„์˜ ์ฐจ์ง‘ํ•ฉ ์—ฐ์‚ฐ์ด ๊ฐ€๋Šฅํ•œ set ํ˜•ํƒœ๋กœ ๋ฐ”๊พธ๊ณ ,

์ฐจ์ง‘ํ•ฉ ์—ฐ์‚ฐ์„ ์ง„ํ–‰ํ•˜์—ฌ 'temp' set์— ๋„ฃ์–ด๋†“์€ ๋’ค,

'temp' set์„ 'ans' ๋ฆฌ์ŠคํŠธ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ •๋ฆฌํ•˜๊ณ ,

์›์†Œ๋ฅผ ์ž‘์€ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด๋‹ค.

o=[]
for i in range(1,31):
    o.append(i)
l=[]
for i in range(28):
    l.append(int(input()))
l.sort()
so=set(o)
sl=set(l)
temp=so-sl
ans=list(temp)
ans.sort()
print(ans[0])
print(ans[1])