728x90
๋ฐ˜์‘ํ˜•

ํˆฌ ํฌ์ธํ„ฐ 1

[๋ฐฑ์ค€] 2470 ๋‘ ์šฉ์•ก (ํŒŒ์ด์ฌ)

๊ณจ๋“œ โ…ค https://www.acmicpc.net/problem/2470 2470๋ฒˆ: ๋‘ ์šฉ์•ก ์ฒซ์งธ ์ค„์—๋Š” ์ „์ฒด ์šฉ์•ก์˜ ์ˆ˜ N์ด ์ž…๋ ฅ๋œ๋‹ค. N์€ 2 ์ด์ƒ 100,000 ์ดํ•˜์ด๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ์šฉ์•ก์˜ ํŠน์„ฑ๊ฐ’์„ ๋‚˜ํƒ€๋‚ด๋Š” N๊ฐœ์˜ ์ •์ˆ˜๊ฐ€ ๋นˆ์นธ์„ ์‚ฌ์ด์— ๋‘๊ณ  ์ฃผ์–ด์ง„๋‹ค. ์ด ์ˆ˜๋“ค์€ ๋ชจ๋‘ -1,000,000,000 ์ด์ƒ 1,000,00 www.acmicpc.net ๐Ÿ“„ ๋ฌธ์ œ KOI ๋ถ€์„ค ๊ณผํ•™์—ฐ๊ตฌ์†Œ์—์„œ๋Š” ๋งŽ์€ ์ข…๋ฅ˜์˜ ์‚ฐ์„ฑ ์šฉ์•ก๊ณผ ์•Œ์นผ๋ฆฌ์„ฑ ์šฉ์•ก์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ๋‹ค. ์‚ฐ์„ฑ ์šฉ์•ก์˜ ํŠน์„ฑ๊ฐ’์€ 1๋ถ€ํ„ฐ 1,000,000,000๊นŒ์ง€์˜ ์–‘์˜ ์ •์ˆ˜๋กœ ๋‚˜ํƒ€๋‚ด๊ณ , ์•Œ์นผ๋ฆฌ์„ฑ ์šฉ์•ก์˜ ํŠน์„ฑ๊ฐ’์€ -1๋ถ€ํ„ฐ -1,000,000,000๊นŒ์ง€์˜ ์Œ์˜ ์ •์ˆ˜๋กœ ๋‚˜ํƒ€๋‚ธ๋‹ค. ๊ฐ™์€ ์–‘์˜ ๋‘ ์šฉ์•ก์„ ํ˜ผํ•ฉํ•œ ์šฉ์•ก์˜ ํŠน์„ฑ๊ฐ’์€ ํ˜ผํ•ฉ์— ์‚ฌ์šฉ๋œ ๊ฐ ์šฉ์•ก์˜ ํŠน์„ฑ๊ฐ’์˜ ํ•ฉ์œผ๋กœ ์ •์˜..

728x90
๋ฐ˜์‘ํ˜•