set

    [Python] ๋ฐฑ์ค€ 1181 ๋‹จ์–ด ์ •๋ ฌ | ๋‚ด์žฅํ•จ์ˆ˜

    ~์‹ค๋ฒ„ 5~ ๋‚ด์žฅ ํƒ€ํŒŒ! ๋‚ด์žฅ ํŒŒ๊ดด! ๋ฌธ์ œ ํ•ด๊ฒฐ์˜ ํฌ์ธํŠธ( ๋‚ด์žฅ ํ•จ์ˆ˜ ) - input ํ•จ์ˆ˜๋Š” ์‹œ๊ฐ„์ด ์งฑ ๋งŽ์ด ๊ฑธ๋ฆฐ๋‹ค - set ํ•จ์ˆ˜๋กœ ์ค‘๋ณต ์ œ๊ฑฐ - sort ํ•จ์ˆ˜ ์ปค์Šคํ„ฐ๋งˆ์ด์ง• 1. ์‹œ๊ฐ„ ์ค„์ด๊ธฐ | ์‹œ๊ฐ„ ์ดˆ๊ณผ ํ”ผํ•˜๊ธฐ | input ๋Œ€์‹  readline import sys n = int(sys.stdin.readline()) words = [] for _ in range(n): words.append(sys.stdin.readline()) sys ๋ชจ๋“ˆ์„ importํ•˜์—ฌ sys.stdin.readline()์„ ์‚ฌ์šฉํ•˜๋ฉด input()๋ณด๋‹ค ์‹œ๊ฐ„์„ ํ™• ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค..! ์ฒ˜์Œ์— ์ž…๋ ฅ์„ ๋ฐ›์„ ๋•Œ ๋ฆฌ์ŠคํŠธ์˜ ํฌ๊ธฐ๋ฅผ ์„ค์ •ํ•˜๊ณ  (ex. list[[0]*50 for i in range(20000)]) ํ–ˆ๋Š”๋ฐ ์™„์ „ํžˆ ํ—ˆํŠผ..