๐Ÿงฉ ์•Œ๊ณ ๋ฆฌ์ฆ˜

๐Ÿงฉ ์•Œ๊ณ ๋ฆฌ์ฆ˜

์žฌ๊ท€๋ž€?

์˜ค๋Š˜์€ ์žฌ๊ท€์— ๋Œ€ํ•ด์„œ ์ •๋ฆฌํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค. ์žฌ๊ท€๋Š” ์ฝ”ํ…Œ์—์„œ ๊ฐ€์žฅ ๋งŽ์ด ๋‚˜์˜ค๋Š” DFS, BFS๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋ฐ˜๋“œ์‹œ ์•Œ์•„์•ผ ํ•˜๋Š” ๋‚ด์šฉ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ •๋ฆฌํ•œ ํ›„์—๋„ ๊ณ„์† ์—ฌ๋Ÿฌ ์˜ˆ์ œ๋“ค์„ ํ’€์–ด๋ณด๋ฉด์„œ ์Šต๋“ํ•ด์•ผ๋  ๊ฒƒ ๊ฐ™๋‹ค. ์žฌ๊ท€๋Š” ์‰ฝ๊ฒŒ ๋งํ•ด์„œ ์ž๊ธฐ ์ž์‹ ์„ ํ˜ธ์ถœํ•˜๋Š” ํ•จ์ˆ˜์ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, 1๋ถ€ํ„ฐ 10๊นŒ์ง€ ๋”ํ•˜์—ฌ ์ถœ๋ ฅํ•˜๋„๋ก ์ž‘์—…ํ•œ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด for๋ฌธ์„ ์ด์šฉํ•˜์—ฌ ์ถœ๋ ฅํ•˜๋Š”๊ฒŒ ๋จผ์ € ๋– ์˜ค๋ฅผ ๊ฒƒ์ด๋‹ค. public class Main { public static void main(String[] args) { System.out.println(loop()); } public static int loop() { int n = 0; for (int i = 1; i

seonghye0n
'๐Ÿงฉ ์•Œ๊ณ ๋ฆฌ์ฆ˜' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก