{"id":180,"date":"2019-10-18T16:09:31","date_gmt":"2019-10-18T07:09:31","guid":{"rendered":"https:\/\/wp.keaven.tokyo\/?p=180"},"modified":"2020-12-04T00:15:44","modified_gmt":"2020-12-03T15:15:44","slug":"%e6%95%b0%e7%8b%ac%e8%a8%88%e7%ae%97%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0","status":"publish","type":"post","link":"https:\/\/wp.keaven.cyou\/?p=180","title":{"rendered":"\u6570\u72ec\u8a08\u7b97\u30d7\u30ed\u30b0\u30e9\u30e0"},"content":{"rendered":"<p>\u6c5a\u3044\u30bd\u30fc\u30b9\u3067\u3059\u304c\u2026<\/p>\n<pre class=\"line-numbers  language-php\"><code>$lsts = array(\n\tarray( 0, 1, 2, 3, 4, 5, 6, 7, 8),\n\tarray( 9,10,11,12,13,14,15,16,17),\n\tarray(18,19,20,21,22,23,24,25,26),\n\tarray(27,28,29,30,31,32,33,34,35),\n\tarray(36,37,38,39,40,41,42,43,44),\n\tarray(45,46,47,48,49,50,51,52,53),\n\tarray(54,55,56,57,58,59,60,61,62),\n\tarray(63,64,65,66,67,68,69,70,71),\n\tarray(72,73,74,75,76,77,78,79,80),\n\n\tarray( 0, 9,18,27,36,45,54,63,72),\n\tarray( 1,10,19,28,37,46,55,64,73),\n\tarray( 2,11,20,29,38,47,56,65,74),\n\tarray( 3,12,21,30,39,48,57,66,75),\n\tarray( 4,13,22,31,40,49,58,67,76),\n\tarray( 5,14,23,32,41,50,59,68,77),\n\tarray( 6,15,24,33,42,51,60,69,78),\n\tarray( 7,16,25,34,43,52,61,70,79),\n\tarray( 8,17,26,35,44,53,62,71,80),\n\n\tarray( 0, 1, 2, 9,10,11,18,19,20),\n\tarray( 3, 4, 5,12,13,14,21,22,23),\n\tarray( 6, 7, 8,15,16,17,24,25,26),\n\tarray(27,28,29,36,37,38,45,46,47),\n\tarray(30,31,32,39,40,41,48,49,50),\n\tarray(33,34,35,42,43,44,51,52,53),\n\tarray(54,55,56,63,64,65,72,73,74),\n\tarray(57,58,59,66,67,68,75,76,77),\n\tarray(60,61,62,69,70,71,78,79,80)\n);\n\n$rst = array();\n$rst['flag'] = true;\n\n\/\/ $target = array(\n\/\/ \t0,0,0, 0,0,0, 0,0,0,\n\/\/ \t0,1,2, 0,0,0, 0,9,0, \n\/\/ \t7,0,0, 9,0,0, 2,1,0,\n\n\/\/ \t0,0,0, 6,0,3, 0,8,0,\n\/\/ \t0,0,8, 0,0,5, 0,2,0,\n\/\/ \t0,3,0, 0,7,2, 1,6,5,\n\n\/\/ \t4,0,0, 0,0,0, 0,3,0,\n\/\/ \t8,6,1, 2,0,0, 0,7,0,\n\/\/ \t0,0,0, 0,0,0, 0,0,0\n\/\/ );\n\n$target = $_POST['lists'];\n\n$tinx = array();\nfor ($i = 0; $i &lt; count($target); $i++)\n{\n\tif ($target[$i] == 0)\n\t{\n\t\t$tinx [] = $i;\n\t}\n}\n\n$i = 0;\n$flag = false;\nwhile(true)\n{\n\tdo\n\t{\n\t\t$target[$tinx[$i]]++;\n\n\t\tif ($target[$tinx[$i]] &gt; 9)\n\t\t{\n\t\t\t$target[$tinx[$i]] = 0;\n\t\t\t$i--;\n\t\t\t$flag = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\twhile (check_duplicate($lsts, $target) == false);\n\n\tif ($flag == true)\n\t{\n\t\t$flag = false;\n\t\tcontinue;\n\t}\n\n\t$i++;\n\n\tif ($i &lt; 0)\n\t{\n\t\t$rst['flag'] = false;\n\t\tbreak;\n\t}\n\telse if ($i &gt;= count($tinx))\n\t{\n\t\tbreak;\n\t}\n}\n\n$rst['lists'] = $target;\n\necho json_encode($rst);\n\nfunction check_duplicate($lsts, $tgt)\n{\n\tforeach($lsts as $lst)\n\t{\n\t\t$arr = array();\n\t\tforeach($lst as $key)\n\t\t{\n\t\t\tif ($tgt[$key] != 0)\n\t\t\t\t$arr[] = $tgt[$key];\n\t\t}\n\n\t\tif (count($arr) &gt; 1)\n\t\t{\n\t\t\t$value_count = array_count_values($arr);\n\t\t\tif (max($value_count) &gt; 1)\n\t\t\t{\n\t\t\t\t\/\/ echo var_dump($lst);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}<\/code><\/pre>\n<p><a href=\"https:\/\/sample.keaven.cyou\/sudoku\/\">https:\/\/sample.keaven.cyou\/sudoku\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6c5a\u3044\u30bd\u30fc\u30b9\u3067\u3059\u304c\u2026 $lsts = array( array( 0, 1, 2, 3, 4, 5, 6, 7, 8), array( 9,10,11,12,13,14,15,16,17), array(18,19,20, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/wp.keaven.cyou\/?p=180\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u6570\u72ec\u8a08\u7b97\u30d7\u30ed\u30b0\u30e9\u30e0&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/posts\/180"}],"collection":[{"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180"}],"version-history":[{"count":4,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions\/200"}],"wp:attachment":[{"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.keaven.cyou\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}