์์ ํ์(3)
-
[์๊ณ ๋ฆฌ์ฆ] ์์ ํ์(CLOCKSYNC)
algospot.com :: CLOCKSYNC Synchronizing Clocks ๋ฌธ์ ์ ๋ณด ๋ฌธ์ ๊ทธ๋ฆผ๊ณผ ๊ฐ์ด 4 x 4 ๊ฐ์ ๊ฒฉ์ ํํ๋ก ๋ฐฐ์น๋ 16๊ฐ์ ์๊ณ๊ฐ ์๋ค. ์ด ์๊ณ๋ค์ ๋ชจ๋ 12์, 3์, 6์, ํน์ 9์๋ฅผ ๊ฐ๋ฆฌํค๊ณ ์๋ค. ์ด ์๊ณ๋ค์ด ๋ชจ๋ 12์๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ๏ฟฝ๏ฟฝ algospot.com #include #include #include using namespace std; queue answer; const int button[10][5] = { {0, 1, 2, -1, -1}, {3, 7, 9, 11, -1}, {4, 10, 14, 15, -1}, {0, 4, 5, 6, 7}, {6, 7, 8, 10, 12}, {0, 2, 14, 15, -1}, {3, 14, 15, -1, -1}, ..
2020.07.28 -
[์๊ณ ๋ฆฌ์ฆ] ์์ ํ์(BOARDCOVER)
algospot.com :: BOARDCOVER ๊ฒ์ํ ๋ฎ๊ธฐ ๋ฌธ์ ์ ๋ณด ๋ฌธ์ H*W ํฌ๊ธฐ์ ๊ฒ์ํ์ด ์์ต๋๋ค. ๊ฒ์ํ์ ๊ฒ์ ์นธ๊ณผ ํฐ ์นธ์ผ๋ก ๊ตฌ์ฑ๋ ๊ฒฉ์ ๋ชจ์์ ํ๊ณ ์๋๋ฐ ์ด ์ค ๋ชจ๋ ํฐ ์นธ์ 3์นธ์ง๋ฆฌ L์ ๋ชจ์์ ๋ธ๋ก์ผ๋ก ๋ฎ๊ณ ์ถ์ต๋๋ค. ์ด ๏ฟฝ๏ฟฝ www.algospot.com #include #include #include using namespace std; queue answer; int row, col; int matrix[20][20]; int run() { /* ์ผ์ชฝ ์ ๋ถํฐ ํ์ํ์ฌ ๋น์ด์๋ ์นธ์ x,y์ ์ ์ฅ * flag ์ง์ ํ์ฌ, ์ฐพ๋ ์ฆ์ ๋ฐ๋ณต๋ฌธ ํ์ถ * x, y๊ฐ ๋ฐ๋ณต๋ฌธ์ ๊ทธ๋๋ก ํต๊ณผํ๋ฉด ๋ชจ๋ ์ฑ์์ก๋ค๋ ์๋ฏธ >> 1์ ๋ฐํ(result์ ๋ํด์ง) */ int x = -1; int ..
2020.07.28 -
[์๊ณ ๋ฆฌ์ฆ] ์์ ํ์(PICNIC)
algospot.com :: PICNIC ์ํ ๋ฌธ์ ์ ๋ณด ๋ฌธ์ ์๋๋ก๋ฉ๋ค ์ ์น์ ์ต์คํ๋ ์ค๋ฐ์์๋ ๋ค์ ์ฃผ์ ์จ๋๊ณต์์ผ๋ก ์ํ์ ๊ฐ๋๋ค. ์์ ์ ์๋์ ์ํ ๋ ํ์๋ค์ ๋ ๋ช ์ฉ ์ง์ ์ง์ด ํ๋ํ๊ฒ ํ๋ ค๊ณ ํฉ๋๋ค. ๊ทธ๋ฐ๋ฐ ์๋ก www.algospot.com #include #include using namespace std; queue answer; // matrix์ ์น๊ตฌ ๊ด๊ณ, paired์ ์น๊ตฌ๊ฐ ์๋์ง ์ฌ๋ถ ์ ์ฅ int matrix[10][10]; int paired[10]; int student_num, pair_num; int makePair() { // ์ง์ด ์๋ ํ์์ด ์๋ค๋ฉด idx์ ์ ์ฅํ๊ณ , ๋ชจ๋ ์ง์ด ์๋ค๋ฉด 1์ ๋ฐํ int idx = -1; for (int i = 0; i < stu..
2020.07.28