jinparksj
@jinparksj
Reviews Written
5
Average Rating
4.8
Posts
Q&A
UDS ๋ฐ์ดํฐ ์๋์
๊ทธ๋ฌ๋ฉด UDS ๊ท๊ฒฉ์์๋ ์ ํด์ง ๋ฐ๋ ์๊ณ , ์์ฑ์ฐจ์ ์ฒด ๊ธฐ์ค์ผ๋ก ์๋์์ ์ ํด์ ์ฌ์ฉํ๋ฉด, ํ๊ตญ ๊ธฐ์ค์ผ๋ก๋ ํ๋ ๊ธฐ์์ฐจ๊ฐ ๊ทธ ์๋์ ๊ท๊ฒฉ์ ์ ํ๊ฒ ๋ค์. ๊ทธ๋ฌ๋ฉด ๊ฐ์ ๋ง์ฝ์ ํ๋์จ์ด ์์ผ๋ก ๊ฐ์ ๋ถํ์ด๋๋ผ๋ ํ ์์ฑ์ฐจ ์ ์ฒด๊ฐ ๋น ์๋์์ ๋ค๋ฅธ ์์ฑ์ฐจ ์ ์ฒด๋ ๋ฆฌํ ์๋์์ ์์ฒญํ๋ฉด UDS ์คํ์ด ์ฌ๋ฌ๊ฐ๋ก ๋๋ ์ง ๊ฐ๋ฅ์ฑ์ด ์๊ฒ ๋ค์.
- 0
- 2
- 162
Q&A
๋ฒจ๋งํฌ๋ ์๊ณ ๋ฆฌ์ฆ
์ ์ ๋ ์ด๊ฒ์ ๋ํด ์ง๋ฌธํ๊ณ ์ถ์๋ ๋ฐ. ์ ์ชฝ j for loop๋ง ๋์๋ ๊ฐ์ด ๋์ค๋ ๊ฒ ๊ฐ์์, ์ ๋ ๊ฐ์ ์ง๋ฌธ๋๋ฆฝ๋๋ค. for (i = 1; i ; i++) { for (j = 0; j ; j++) { int start = Ed[j].s; // 1, 1, 2, int end = Ed[j].e; // 2, 3, 3, int cost = Ed[j].val; // 5, 4, -3, if (dist[start] != 2147000000 && dist[start] + cost dist[end] = dist[start] + cost; cout i "/" j " - " "start : " start ", " "end : " end ", " "total cost : " dist[end] endl; } } cout i endl;}1/0 - start : 1, end : 2, total cost : 5 1/1 - start : 1, end : 3, total cost : 4 1/2 - start : 2, end : 3, total cost : 2 1/3 - start : 2, end : 5, total cost : 18 1/4 - start : 3, end : 4, total cost : 7 1/6 - start : 4, end : 5, total cost : 14 1 2 3 4
- 1
- 5
- 603




