ํฌ๋„์ฃผ ์‹œ์‹

    [BOJ_2156] ํฌ๋„์ฃผ ์‹œ์‹ (java)

    [BOJ_2156] ํฌ๋„์ฃผ ์‹œ์‹ (java)

    ๋ฌธ์ œ๋งํฌ https://www.acmicpc.net/problem/2156 2156๋ฒˆ: ํฌ๋„์ฃผ ์‹œ์‹ ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹ํšŒ์— ๊ฐ”๋‹ค. ๊ทธ ๊ณณ์— ๊ฐ”๋”๋‹ˆ, ํ…Œ์ด๋ธ” ์œ„์— ๋‹ค์–‘ํ•œ ํฌ๋„์ฃผ๊ฐ€ ๋“ค์–ด์žˆ๋Š” ํฌ๋„์ฃผ ์ž”์ด ์ผ๋ ฌ๋กœ ๋†“์—ฌ ์žˆ์—ˆ๋‹ค. ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹์„ ํ•˜๋ ค๊ณ  ํ•˜๋Š”๋ฐ, ์—ฌ๊ธฐ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‘ ๊ฐ€์ง€ ๊ทœ www.acmicpc.net ๋ฌธ์ œ์„ค๋ช… ๋”๋ณด๊ธฐ ๋”๋ณด๊ธฐ ๋ฌธ์ œ ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹ํšŒ์— ๊ฐ”๋‹ค. ๊ทธ ๊ณณ์— ๊ฐ”๋”๋‹ˆ, ํ…Œ์ด๋ธ” ์œ„์— ๋‹ค์–‘ํ•œ ํฌ๋„์ฃผ๊ฐ€ ๋“ค์–ด์žˆ๋Š” ํฌ๋„์ฃผ ์ž”์ด ์ผ๋ ฌ๋กœ ๋†“์—ฌ ์žˆ์—ˆ๋‹ค. ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹์„ ํ•˜๋ ค๊ณ  ํ•˜๋Š”๋ฐ, ์—ฌ๊ธฐ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‘ ๊ฐ€์ง€ ๊ทœ์น™์ด ์žˆ๋‹ค. ํฌ๋„์ฃผ ์ž”์„ ์„ ํƒํ•˜๋ฉด ๊ทธ ์ž”์— ๋“ค์–ด์žˆ๋Š” ํฌ๋„์ฃผ๋Š” ๋ชจ๋‘ ๋งˆ์…”์•ผ ํ•˜๊ณ , ๋งˆ์‹  ํ›„์—๋Š” ์›๋ž˜ ์œ„์น˜์— ๋‹ค์‹œ ๋†“์•„์•ผ ํ•œ๋‹ค. ์—ฐ์†์œผ๋กœ ๋†“์—ฌ ์žˆ๋Š” 3์ž”์„ ๋ชจ๋‘ ๋งˆ์‹ค ์ˆ˜๋Š” ์—†๋‹ค...