{"id":2233,"date":"2009-09-30T16:42:54","date_gmt":"2009-09-30T16:42:54","guid":{"rendered":"http:\/\/192.168.0.71:9090\/?p=1935"},"modified":"2009-09-30T16:42:54","modified_gmt":"2009-09-30T16:42:54","slug":"programming-challenges-%ec%a7%80%eb%a2%b0%ec%b0%be%ea%b8%b0-minesweeper","status":"publish","type":"post","link":"https:\/\/talsu.net\/?p=2233","title":{"rendered":"Programming Challenges &#8211; \uc9c0\ub8b0\ucc3e\uae30 (Minesweeper)"},"content":{"rendered":"<p><span style=\"font-size: 12pt; font-weight: bold;\"><a title=\"[http:\/\/programming-challenges.com\/pg.php?page=downloadproblem&amp;probid=110102&amp;format=html]\ub85c \uc774\ub3d9\ud569\ub2c8\ub2e4.\" target=\"_blank\" href=\"http:\/\/programming-challenges.com\/pg.php?page=downloadproblem&amp;probid=110102&amp;format=html\">\ubb38\uc81c &lt;- \ud074\ub9ad<\/a><\/span><\/p>\n<p>\uc7ac\ubbf8\uc788\ub2e4.! \ud558\uc9c0\ub9cc \ucc44\uc810 \ub85c\ubd07\uc774 \ub108\ubb34&#8230; \uacf5\ubc31 \uc904 \ud558\ub098 \ub54c\ubb38\uc5d0 \uac78\uace0 \ub118\uc5b4\uc838\uc11c \uc2e4\ub9dd\uc774\ub2e4.<\/p>\n<pre class=\"lang:c++ decode:true\">#include <iostream>\n#define MAX 100\n\nint main() {\n\tchar field[MAX + 1][MAX + 1];\n\tlong row, col;\n\tint fieldNumber = 1;\n\twhile (scanf(\"%ld %ld\", &amp;col, &amp;row) == 2) {\n\t\tif (col == 0 &amp;&amp; row == 0) \/\/0 0\uc774\uba74 \uc885\ub8cc\n\t\t\tbreak;\n\t\tfor (int i = 0; i <= row; ++i) \/\/\ub9c8\uc9c0\ub9c9\uc904 \ub2e4\uc74c\uc904\ub9cc \ucd08\uae30\ud654 \ud55c\ub2e4\n\t\t\tfield[col][i] = 0;\n\n\t\tfor (int i = 0; i < col; ++i) {\n\t\t\tscanf(\"%s\", field[i]);\n\t\t\tfield[i][row] = 0;\t\/\/\uc785\ub825 \ubc1b\uace0 \ub9c8\uc9c0\ub9c9 \uae00\uc790 \ub2e4\uc74c \uae00\uc790 \ucd08\uae30\n\t\t}\n\t\tif (fieldNumber > 1)\t\/\/\uc774\uac70\ub54c\ub9e4 \uc560\uba39\uc74c.. \ub9c8\uc9c0\ub9c9\uc5d0 \uacf5\ubc31\uc774 \uc5c6\uc5b4\uc57c \ucc44\uc810\uc774 \ub428\n\t\t\tputchar('n');\n\n\t\tprintf(\"Field #%d:n\", fieldNumber++);\n\n\t\tfor (int colIndex = 0; colIndex < col; ++colIndex) {\n\t\t\tfor (int rowIndex = 0; rowIndex < row; ++rowIndex) {\n\t\t\t\tif (field[colIndex][rowIndex] == '*') {\n\t\t\t\t\tputchar('*');\n\t\t\t\t} else if (field[colIndex][rowIndex] == '.') {\n\t\t\t\t\tint bombCounter = 0;\n\t\t\t\t\tfor (int relativeCol = -1; relativeCol <= 1; ++relativeCol) {\n\t\t\t\t\t\tfor (int relativeRow = -1; relativeRow <= 1; ++relativeRow) { \/\/\uc8fc\ubcc0\uc744 \ud0d0\uc0c9\n\t\t\t\t\t\t\tint checkCol = colIndex + relativeCol;\n\t\t\t\t\t\t\tint checkRow = rowIndex + relativeRow;\n\t\t\t\t\t\t\tif (checkCol >= 0 &amp;&amp; checkRow >= 0 &amp;&amp; field[checkCol][checkRow] == '*')\n\t\t\t\t\t\t\t\tbombCounter++; \/\/\ud3ed\ud0c4\uc758 \uac2f\uc218\ub97c \uce74\uc6b4\ud2b8\ud568\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tprintf(\"%d\", bombCounter);\n\t\t\t\t}\n\t\t\t}\n\t\t\tputchar('n');\n\t\t}\n\t}\n\treturn 0;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ubb38\uc81c &lt;- \ud074\ub9ad \uc7ac\ubbf8\uc788\ub2e4.! \ud558\uc9c0\ub9cc \ucc44\uc810 \ub85c\ubd07\uc774 \ub108\ubb34&#8230; \uacf5\ubc31 \uc904 \ud558\ub098 \ub54c\ubb38\uc5d0 \uac78\uace0 \ub118\uc5b4\uc838\uc11c \uc2e4\ub9dd\uc774\ub2e4. #include #define MAX 100 int main() { char field[MAX + 1][MAX + 1]; long row, col; int fieldNumber = 1; while (scanf(&#8220;%ld %ld&#8221;, &amp;col, &amp;row) == 2) { if (col == 0 &amp;&amp; row == 0) \/\/0 0\uc774\uba74 \uc885\ub8cc break; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[9],"tags":[49,69,67,174,203,385],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pXV5a-A1","_links":{"self":[{"href":"https:\/\/talsu.net\/index.php?rest_route=\/wp\/v2\/posts\/2233"}],"collection":[{"href":"https:\/\/talsu.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/talsu.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/talsu.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/talsu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2233"}],"version-history":[{"count":0,"href":"https:\/\/talsu.net\/index.php?rest_route=\/wp\/v2\/posts\/2233\/revisions"}],"wp:attachment":[{"href":"https:\/\/talsu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/talsu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/talsu.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}