{"id":158929,"date":"2020-09-19T08:13:25","date_gmt":"2020-09-19T00:13:25","guid":{"rendered":"http:\/\/4563.org\/?p=158929"},"modified":"2020-09-19T08:13:25","modified_gmt":"2020-09-19T00:13:25","slug":"%e7%9c%9f%e5%ae%9e%e7%ae%97%e6%b3%95-%e4%bc%98%e5%8c%96-%e6%b1%82%e5%8a%a9","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=158929","title":{"rendered":"\u771f\u5b9e\u7b97\u6cd5 \u4f18\u5316 \u6c42\u52a9"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u771f\u5b9e\u7b97\u6cd5 \u4f18\u5316 \u6c42\u52a9               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhaogaz <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>https:\/\/item.taobao.com\/item.htm?id=609807807418<\/p>\n<p>\u8fd9\u4e2a\u62fc\u56fe\u6446\u653e\u65b9\u5f0f\u5982\u4f55\u7528\u7b97\u6cd5\u5b9e\u73b0\uff1f<\/p>\n<p>\u6211\u771f\u7684\u4e70\u4e86\uff0c\u786e\u5b9e\u62fc\u4e0d\u51fa\u6765\u3002\u4e0d\u662f\u5e7f\u544a\u3002<\/p>\n<p>\u6211\u5c1d\u8bd5\u7528\u5199\u4e86\u4e2a\u7b97\u6cd5 \u8bd5\u4e86\u4e0b\uff0c\u80fd\u8dd1\uff0c\u5f88\u6162\u3002\u5e0c\u671b\u5927\u54e5\u4eec\u80fd\u6559\u6559\u5982\u4f55\u4f18\u5316<\/p>\n<pre><code> package com.aliware.tianchi;  public class puzzle11j {     public static int[][][] j_Offset = {         {{0, 4}, {0, 3}, {0, 2}, {0, 1}, {0, 0}, {1, 0}, {2, 0}, {2, 1}},         {{4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}, {0, 1}, {0, 0}, {1, 0}},         {{2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {1, 4}, {0, 4}, {0, 3}},         {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {4, 1}, {4, 2}, {3, 2}},          {{0, 1}, {0, 0}, {1, 0}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}},         {{3, 0}, {4, 0}, {4, 1}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},         {{2, 3}, {2, 4}, {1, 4}, {0, 4}, {0, 3}, {0, 2}, {0, 1}, {0, 0}},         {{1, 2}, {0, 2}, {0, 1}, {0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}     };     public static int boardMaxLength = 10;     public static void main(String[] args) {         put(new int[boardMaxLength][boardMaxLength],0,0,11);     } \/\/    public static int boardMaxLength = 6; \/\/    public static void main(String[] args) { \/\/        put(new int[boardMaxLength][boardMaxLength],0,0,4); \/\/    }      public static boolean can_set(int[][] board, int x, int y, int offset_index) {         for (final int[] offset : j_Offset[offset_index]) {             int real_x_location = x + offset[0];             int real_y_location = y + offset[1];             \/\/\u4e0d\u51fa\u754c             if (real_x_location &gt; boardMaxLength-1) return false;             if (real_y_location &gt; boardMaxLength-1) return false;             \/\/\u6ca1\u91cd\u53e0             if (board[real_x_location][real_y_location] != 0) return false;         }         return true;     }      public static void put(int[][] board, int after_x,int after_y ,int left_j_num) {         if (left_j_num == 0) {             print_board(board);             return;         }         if(after_x&gt;(boardMaxLength-2) || after_y &gt;(boardMaxLength-2)){             return;         }         for (int x = after_x; x &lt; boardMaxLength-2; x++) {             for (int y = after_y; y &lt; boardMaxLength-2; y++) {                 board = test_j(board, left_j_num, x, y);              }         }         for (int x = 0; x &lt; after_x; x++) {             for (int y = after_y; y &lt; boardMaxLength-2; y++) {                 board = test_j(board, left_j_num, x, y);             }         }         for (int x = after_x; x &lt; boardMaxLength-2; x++) {             for (int y = 0; y &lt; after_y; y++) {                 board = test_j(board, left_j_num, x, y);              }         }     }      private static int[][] test_j(int[][] board, final int left_j_num, final int x, final int y) {         for (int j_index = 0; j_index &lt; j_Offset.length; j_index++) {             if (can_set(board, x, y, j_index)) {                 board = mark_board(board, x, y, j_index, left_j_num);                 put(board, x+1,y+1,left_j_num - 1);                 board = clean_board(board,x,y,j_index);             }         }         return board;     }      public static int[][] mark_board(int[][] board, int x, int y, int offset_index, int left_j) {         for (final int[] offset : j_Offset[offset_index]) {             int real_x_location = x + offset[0];             int real_y_location = y + offset[1];              board[real_x_location][real_y_location] = left_j;         }         return board;     }      public static int[][] clean_board(int[][] board, int x, int y, int offset_index) {         return mark_board(board, x, y, offset_index, 0);     }      public static void print_board(int[][] board) {         for (int x = 0; x &lt; boardMaxLength; x++) {             for (int y = 0; y &lt; boardMaxLength; y++) {                 System.err.print((char) (board[x][y]+64)+\" \");             }             System.err.println(\"\");         }         System.err.println(\"\");     }  }  <\/code><\/pre>\n<p>\u628a\u6ce8\u91ca\u89e3\u5f00\uff0c\u5373\u53ef\u6d4b\u8bd5\uff0c\u6ca1\u6bdb\u75c5\uff0c\u5c31\u662f\u6162\u3002<\/p>\n<p>\u7b97\u6cd5\u903b\u8f91\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<ul>\n<li>\u628a j \u7684\u5f62\u72b6\u679a\u4e3e\u51fa\u6765\uff0c\u5305\u542b\u955c\u50cf\uff0c\u4e00\u5171 8 \u4e2a<\/li>\n<li>\u4e00\u6b65\u4e00\u6b65\u8bd5\u9a8c\uff0c\u80fd\u4e0d\u80fd\u653e\u8fdb\u53bb\u3002<\/li>\n<li>j \u7684\u6570\u91cf\u8d8a\u6765\u8d8a\u5c11\uff0c0 \u7684\u65f6\u5019\uff0c\u76f4\u63a5\u8f93\u51fa\u5bf9\u5e94\u7684\u56fe\u8c61<\/li>\n<\/ul>\n<p>\u53ef\u80fd\u7b97\u662f\u5e7f\u5ea6\u4f18\u5148\u7b97\u6cd5\uff0c\u786e\u5b9e\u60f3\u4e0d\u5230\u5176\u4ed6\u7684\u526a\u679d\u6280\u5de7<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3411161\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Raven316 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5e2e\u9876                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3411162\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zhaogaz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u633d\uff0c\u771f\u7684\u6ca1\u6709\u4eba\u80fd\u6551\u6551\u8001\u54e5\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3411163\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nextFault <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53d8\u79cd\u516b\u7687\u540e\uff0c\u6b63\u5e38\u56de\u6eaf\u590d\u6742\u5ea6\u5e38\u91cf\u7ea7\u6162\u4e0d\u4e86\u5427\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3411164\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Hyouka <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5f88\u591a\u7c7b\u578b\u8fd9\u6837\u7684 puzzle \u62fc\u56fe,\u662f\u6709\u4e00\u4e24\u5757\u662f\u6253\u659c\u653e\u7684;<br \/>\u4e0d\u8fc7\u4f60\u7684\u89e3\u5f00\u4e86&#8230;\u5e94\u8be5\u4e0d\u662f\u8fd9\u7c7b;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3411165\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zhaogaz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @nextFault \u4e0a\u9762\u7684\u4ee3\u7801\u5df2\u7ecf\u8dd1\u4e86\u8d85\u8fc7 24h \u4e86 \u8fd8\u6ca1\u6709\u51fa\u7ed3\u679c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u771f\u5b9e\u7b97\u6cd5 \u4f18\u5316 \u6c42\u52a9 \u8cc7\u6df1\u5927\u4f6c :&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/158929"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158929"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/158929\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158929"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}