{"id":334724,"date":"2022-06-20T03:00:08","date_gmt":"2022-06-20T03:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=334724"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=334724","title":{"rendered":"<span>\u0417\u043c\u0435\u0439\u043a\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b, \u043a\u0430\u043a \u0438 \u044f, \u0443\u0441\u0442\u0440\u0430\u0448\u0438\u043b\u0438\u0441\u044c <a href=\"https:\/\/habr.com\/ru\/post\/672198\/\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0432\u0443\u0445\u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043a\u0442\u0430\u0442\u0430<\/a> \u043a\u043e\u043b\u043b\u0435\u0433\u0438<a class=\"mention\" href=\"\/users\/Orazbek_B\">@Orazbek_B<\/a>, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u044d\u0442\u043e \u043a\u0440\u043e\u0445\u043e\u0442\u043d\u043e\u0435 \u044d\u0441\u0441\u0435. \u0421\u043f\u0435\u0440\u0432\u0430 \u2013 \u043a\u043e\u0434 \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435:<\/p>\n<pre><code class=\"python\">n, m = 5, 8  # \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b  def draw(title, f):     print(f\"\\n{title:-^{m * 3 - 1}}\")     res = [\"\"] * (n * m)     for i, j in enumerate(sorted(range(n * m), key=lambda i: f(i \/\/ m, i % m))):         res[j] = f\"{i:>02}\"     for i in range(0, n * m, m):         print(*res[i:i + m])  draw(\"horizontal\", lambda y, x: (y, -x if y % 2 else x)) draw(\"diagonal\"  , lambda y, x: (y + x, x if (y + x) % 2 else -x))<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0435 \u0437\u043c\u0435\u0439\u043a\u0438:<\/p>\n<p><code>------horizontal-------<\/code><\/p>\n<p><code>00 01 02 03 04 05 06 07<\/code><\/p>\n<p><code>15 14 13 12 11 10 09 08<\/code><\/p>\n<p><code>16 17 18 19 20 21 22 23<\/code><\/p>\n<p><code>31 30 29 28 27 26 25 24<\/code><\/p>\n<p><code>32 33 34 35 36 37 38 39<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code>-------diagonal--------<\/code><\/p>\n<p><code>00 02 03 09 10 19 20 29<\/code><\/p>\n<p><code>01 04 08 11 18 21 28 30<\/code><\/p>\n<p><code>05 07 12 17 22 27 31 36<\/code><\/p>\n<p><code>06 13 16 23 26 32 35 37<\/code><\/p>\n<p><code>14 15 24 25 33 34 38 39<\/code><\/p>\n<p><code><br \/><\/code>\u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e: \u043a\u0430\u0436\u0434\u043e\u0439 \u0435\u0433\u043e \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u044e\u0447, \u0447\u0442\u043e\u0431\u044b, \u0431\u0443\u0434\u0443\u0447\u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u044f\u0447\u0435\u0439\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0431\u044b \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>\u041d\u0430\u0448\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0435 \u0437\u043b\u043e\u0431\u043d\u044b\u0435, \u043e\u043d\u0438 \u043c\u044f\u0433\u043a\u0438\u0435 \u0438 \u043f\u0443\u0448\u0438\u0441\u0442\u044b\u0435. \u0411\u043e\u043d\u0443\u0441: \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435. \u041c\u043e\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043f\u0438\u0440\u0430\u043b\u044c\u043a\u0443, \u0445\u043e\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e, \u0445\u043e\u0442\u044c \u0440\u043e\u043c\u0431\u0438\u0447\u0435\u0441\u043a\u0443\u044e, \u0445\u043e\u0442\u044c \u043e\u043a\u0440\u0443\u0433\u043b\u0443\u044e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043b\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0430 \u0444\u0438\u0433\u0443\u0440\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u2013 \u0431\u044b\u043b\u043e \u0431\u044b \u0436\u0435\u043b\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0438,  \u0447\u0442\u043e \u0442\u0430\u043a \u043a\u043e\u0440\u043e\u0442\u0435\u043d\u044c\u043a\u043e: \u043e \u0447\u0451\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u043e \u0447\u0435\u043c  ?<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/672296\/\"> https:\/\/habr.com\/ru\/post\/672296\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b, \u043a\u0430\u043a \u0438 \u044f, \u0443\u0441\u0442\u0440\u0430\u0448\u0438\u043b\u0438\u0441\u044c <a href=\"https:\/\/habr.com\/ru\/post\/672198\/\" rel=\"noopener noreferrer nofollow\">\u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0432\u0443\u0445\u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u043a\u0442\u0430\u0442\u0430<\/a> \u043a\u043e\u043b\u043b\u0435\u0433\u0438<a class=\"mention\" href=\"\/users\/Orazbek_B\">@Orazbek_B<\/a>, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u044d\u0442\u043e \u043a\u0440\u043e\u0445\u043e\u0442\u043d\u043e\u0435 \u044d\u0441\u0441\u0435. \u0421\u043f\u0435\u0440\u0432\u0430 \u2013 \u043a\u043e\u0434 \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435:<\/p>\n<pre><code class=\"python\">n, m = 5, 8  # \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b  def draw(title, f):     print(f\"\\n{title:-^{m * 3 - 1}}\")     res = [\"\"] * (n * m)     for i, j in enumerate(sorted(range(n * m), key=lambda i: f(i \/\/ m, i % m))):         res[j] = f\"{i:>02}\"     for i in range(0, n * m, m):         print(*res[i:i + m])  draw(\"horizontal\", lambda y, x: (y, -x if y % 2 else x)) draw(\"diagonal\"  , lambda y, x: (y + x, x if (y + x) % 2 else -x))<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u0435 \u0437\u043c\u0435\u0439\u043a\u0438:<\/p>\n<p><code>------horizontal-------<\/code><\/p>\n<p><code>00 01 02 03 04 05 06 07<\/code><\/p>\n<p><code>15 14 13 12 11 10 09 08<\/code><\/p>\n<p><code>16 17 18 19 20 21 22 23<\/code><\/p>\n<p><code>31 30 29 28 27 26 25 24<\/code><\/p>\n<p><code>32 33 34 35 36 37 38 39<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code>-------diagonal--------<\/code><\/p>\n<p><code>00 02 03 09 10 19 20 29<\/code><\/p>\n<p><code>01 04 08 11 18 21 28 30<\/code><\/p>\n<p><code>05 07 12 17 22 27 31 36<\/code><\/p>\n<p><code>06 13 16 23 26 32 35 37<\/code><\/p>\n<p><code>14 15 24 25 33 34 38 39<\/code><\/p>\n<p><code><br \/><\/code>\u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e: \u043a\u0430\u0436\u0434\u043e\u0439 \u0435\u0433\u043e \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u044e\u0447, \u0447\u0442\u043e\u0431\u044b, \u0431\u0443\u0434\u0443\u0447\u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u044f\u0447\u0435\u0439\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0431\u044b \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>\u041d\u0430\u0448\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0435 \u0437\u043b\u043e\u0431\u043d\u044b\u0435, \u043e\u043d\u0438 \u043c\u044f\u0433\u043a\u0438\u0435 \u0438 \u043f\u0443\u0448\u0438\u0441\u0442\u044b\u0435. \u0411\u043e\u043d\u0443\u0441: \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435. \u041c\u043e\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043f\u0438\u0440\u0430\u043b\u044c\u043a\u0443, \u0445\u043e\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e, \u0445\u043e\u0442\u044c \u0440\u043e\u043c\u0431\u0438\u0447\u0435\u0441\u043a\u0443\u044e, \u0445\u043e\u0442\u044c \u043e\u043a\u0440\u0443\u0433\u043b\u0443\u044e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043b\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0430 \u0444\u0438\u0433\u0443\u0440\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u2013 \u0431\u044b\u043b\u043e \u0431\u044b \u0436\u0435\u043b\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0438,  \u0447\u0442\u043e \u0442\u0430\u043a \u043a\u043e\u0440\u043e\u0442\u0435\u043d\u044c\u043a\u043e: \u043e \u0447\u0451\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u043e \u0447\u0435\u043c  ?<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/672296\/\"> https:\/\/habr.com\/ru\/post\/672296\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-334724","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334724"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/334724\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}