{"id":268,"date":"2007-11-28T08:22:52","date_gmt":"2007-11-28T08:22:52","guid":{"rendered":"http:\/\/pchero21.com\/?p=268"},"modified":"2007-11-28T08:22:52","modified_gmt":"2007-11-28T08:22:52","slug":"n-%ec%97%ac%ec%99%95%eb%a7%90-%eb%ac%b8%ec%a0%9c%eb%90%98%ec%b6%94%ec%a0%81-%ec%95%8c%ea%b3%a0%eb%a6%ac%ec%a6%98-%ec%86%8c%ec%8a%a4-%ec%bd%94%eb%93%9c","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=268","title":{"rendered":"N-\uc5ec\uc655\ub9d0 \ubb38\uc81c(\ub418\ucd94\uc801 \uc54c\uace0\ub9ac\uc998) \uc18c\uc2a4 \ucf54\ub4dc"},"content":{"rendered":"<p>#include &lt;stdio.h&gt;<br \/>#include &lt;stdlib.h&gt;<br \/>#include &lt;math.h&gt;<\/p>\n<p>void queens(int i);<br \/>bool promising(int i);<\/p>\n<p>int n;<br \/>int *col;<\/p>\n<p>int main()<br \/>{<\/p>\n<p>&nbsp;printf(&#8220;Insert Number&#8230;n&#8221;);<br \/>&nbsp;printf(&#8220;Insert : &#8220;);<br \/>&nbsp;scanf(&#8220;%d&#8221;, &amp;n);<\/p>\n<p>&nbsp;col = (int *)malloc(n * sizeof(int));<br \/>&nbsp;queens(0);<\/p>\n<p>&nbsp;return 0;<br \/>}<\/p>\n<p>void queens(int i)<br \/>{<br \/>&nbsp;int j, tmp;<\/p>\n<p>&nbsp;if(promising(i))<br \/>&nbsp; if(i == N) {<br \/>&nbsp; &nbsp;for(tmp = 1; tmp &lt;= N; tmp++)<br \/>&nbsp; &nbsp; printf(&#8220;%d &#8220;, col[tmp]);<br \/>&nbsp; &nbsp;printf(&#8220;n&#8221;);<br \/>&nbsp; }<br \/>&nbsp; else<br \/>&nbsp; &nbsp;for(j = 1; j &lt;= N; j++) {<br \/>&nbsp; &nbsp; col[i + 1] = j;<br \/>&nbsp; &nbsp; queens(i + 1);<br \/>&nbsp; &nbsp;}<br \/>}<\/p>\n<p>bool promising(int i)<br \/>{<br \/>&nbsp;int k;<br \/>&nbsp;bool result;<\/p>\n<p>&nbsp;k = 1;<br \/>&nbsp;result = true;<\/p>\n<p>&nbsp;while(k &lt; i &amp;&amp; result) {<br \/>&nbsp; if(col[i] == col[k] || abs(col[i] &#8211; col[k]) == i &#8211; k)<br \/>&nbsp; &nbsp;result = false;<br \/>&nbsp; k++;<br \/>&nbsp;}<br \/>&nbsp;return result;<br \/>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;#include &lt;math.h&gt; void queens(int i);bool promising(int i); int n;int *col; int main(){ &nbsp;printf(&#8220;Insert Number&#8230;n&#8221;);&nbsp;printf(&#8220;Insert : &#8220;);&nbsp;scanf(&#8220;%d&#8221;, &amp;n); &nbsp;col = (int *)malloc(n * sizeof(int));&nbsp;queens(0); &nbsp;return 0;} void queens(int i){&nbsp;int j, tmp; &nbsp;if(promising(i))&nbsp; if(i == N) {&nbsp; &nbsp;for(tmp = 1; &hellip; <a href=\"http:\/\/pchero21.com\/?p=268\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[33],"tags":[],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/268"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}