Banner

My Tech Blog (๋น„๊ต)

โœ… ๋ฌธ์ œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ˆซ์ž๊ฐ€ ๋‹ด๊ธด 1์ฐจ์› ๋ฐฐ์—ด์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ๋‘ ๊ฐœ์˜ ์ˆซ์ž๋ฅผ ๋ฝ‘์•„ ์„œ๋กœ์˜ ๊ฑฐ๋ฆฌ๋ฅผ ๋น„๊ตํ•œ ํ›„ ๊ฑฐ๋ฆฌ๊ฐ€ ๊ฐ€์žฅ ์ž‘์€ ์ˆซ์ž์˜ ์œ„์น˜(index)๋ฅผ ์ถœ๋ ฅํ•˜์‹œ์˜ค. โœ… ์ฝ”๋“œpublic class Main { public static void main(String[] args) { int[] point = { 92, 32, 52, 9, 81, 2, 68 }; int dist = 1000000000; int[] result = new int[2]; for (int i = 0; i Math.abs(point[i] - point[j])) { dist = Math.abs(point[i] - point[j]); result[0] = i; result[1] = j; } ..
์ธ์ ˆ๋ฏธ์˜€๋˜๊ฒƒ
'๋น„๊ต' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก
์ƒ๋‹จ์œผ๋กœ