{"id":3831,"date":"2018-11-21T20:31:18","date_gmt":"2018-11-21T17:31:18","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3831"},"modified":"2018-12-18T23:34:28","modified_gmt":"2018-12-18T20:34:28","slug":"e-olymp-2668-%d1%81%d0%bf%d0%b8%d1%80%d0%b0%d0%bb%d1%8c","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3831","title":{"rendered":"e-olymp 2668. \u0421\u043f\u0438\u0440\u0430\u043b\u044c"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 $n \u00d7 n$ \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0430\u043c\u0438 \u043f\u043e \u0441\u043f\u0438\u0440\u0430\u043b\u0438 (\u0441\u043c. \u043f\u0440\u0438\u043c\u0435\u0440).<\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u041e\u0434\u043d\u043e \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$, \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0435\u0435 $50$.<\/p>\n<h1>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u043f\u0438\u0440\u0430\u043b\u044c. \u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c $0$.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table>\n<tbody>\n<tr>\n<td><strong>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/td>\n<td><strong>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/td>\n<\/tr>\n<tr>\n<td>[latex]7[\/latex]<\/td>\n<td>[latex]1111111 \\\\ 0000001 \\\\ 1111101 \\\\ 1000101 \\\\ 1011101 \\\\ 1000001 \\\\ 1111111[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]1[\/latex]<\/td>\n<td>[latex]0[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]3[\/latex]<\/td>\n<td>[latex]111 \\\\ 001 \\\\ 111[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]5[\/latex]<\/td>\n<td>[latex]11111 \\\\ 00001 \\\\ 11001 \\\\ 10001 \\\\ 11111[\/latex]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h1>\n<pre class=\"lang:java decode:true \" title=\"e-olymp 2668 spiral\">import java.util.Scanner;\r\n \r\npublic class Main {\r\n\tpublic static void main (String[] args) {\r\n\t\tScanner scanner = new Scanner(System.in);\r\n\t\tint n = scanner.nextInt();\r\n\t\tint [][] s = new int[50][50];\r\n\t\tfor(int i=0; i&lt;n; i++)\r\n\t\t{\r\n\t\t\ts[0][i]=1;\r\n\t\t\ts[n-1][i]=1;\r\n\t\t\ts[i][n-1]=1;\r\n\t\t}\r\n\t\tint h=n-2, d=n-2;\r\n\t\tint pointx=n-1, pointy=0; \r\n\t\twhile(true)\r\n\t\t{\r\n\t\t\tfor(int i=0; i&lt;h; i++)\r\n\t\t\t{\r\n\t\t\t    s[pointx-i][pointy]=1;\r\n\t\t\t}\r\n\t\t\tpointx-=h-1;\r\n\t\t\th-=2;\r\n\t\t\tif(h&lt;=0)\r\n\t\t\t    break;\r\n\t\t\tfor(int i=0; i&lt;d; i++)\r\n\t\t\t{\r\n\t\t\t    s[pointx][pointy+i]=1;\r\n\t\t\t}\r\n\t\t\tpointy+=d-1;\r\n\t\t\td-=2;\r\n\t\t\tif(d&lt;=0)\r\n\t\t\t    break;\r\n\t\t    for(int i=0; i&lt;h; i++)\r\n\t\t\t{\r\n\t\t\t    s[pointx+i][pointy]=1;\r\n\t\t\t}\r\n\t\t\tpointx+=h-1;\r\n\t\t\th-=2;\r\n\t\t\tif(h&lt;=0)\r\n\t\t\t    break;\r\n\t\t\tfor(int i=0; i&lt;d; i++)\r\n\t\t\t{\r\n\t\t\t    s[pointx][pointy-i]=1;\r\n\t\t\t}\r\n\t\t\tpointy-=d-1;\r\n\t\t\td-=2;\r\n\t\t\tif(d&lt;=0)\r\n\t\t\t    break;\r\n\t\t}\r\n\t\ts[n\/2][n\/2]=0;\r\n\t\tfor(int i=0; i&lt;n; i++)\r\n\t\t{\r\n\t\t\tfor(int j=0; j&lt;n; j++)\r\n\t\t\t{\r\n\t\t\t    System.out.print(s[i][j]);\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t}\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h1>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u0435\u0440\u0445\u043d\u044e\u044e, \u043d\u0438\u0436\u043d\u044e\u044e \u0438 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438 \u0437\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438. \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u043c \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0432 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f (\u0432\u0432\u0435\u0440\u0445, \u0432\u043f\u0440\u0430\u0432\u043e, \u0432\u043d\u0438\u0437, \u0432\u043b\u0435\u0432\u043e). \u041c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 (\u0448\u0438\u0440\u0438\u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u043f\u0440\u0430\u0432\u043e \u0438 \u0432\u043b\u0435\u0432\u043e, \u0432\u044b\u0441\u043e\u0442\u0435 &#8212; \u0432\u0432\u0435\u0440\u0445 \u0438 \u0432\u043d\u0438\u0437). \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043e\u0442\u0440\u0435\u0437\u043e\u043a (\u0448\u0438\u0440\u0438\u043d\u0443 \u0438\u043b\u0438 \u0432\u044b\u0441\u043e\u0442\u0443) \u043d\u0430 $2$ \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0431\u043e\u043b\u044c\u0448\u0435 $0$, \u0438\u043d\u0430\u0447\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c. \u041d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043c \u0435\u0449\u0435 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0442\u043e\u0447\u043a\u0438, \u043e\u0442\u043a\u0443\u0434\u0430 \u043d\u0430\u0447\u043d\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433.<br \/>\nP.s. \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 www.e-olymp.com \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437-\u0437\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 $5$-\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u0423 \u043d\u0438\u0445 \u0432 $5$-\u043e\u043c \u0442\u0435\u0441\u0442\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 $1$, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.       <\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p><a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/2668\" rel=\"noopener\" target=\"_blank\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 e-olymp<\/a><br \/>\n<a href=\"https:\/\/ideone.com\/Ug55rB\" rel=\"noopener\" target=\"_blank\">\u041a\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 $n \u00d7 n$ \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0430\u043c\u0438 \u043f\u043e \u0441\u043f\u0438\u0440\u0430\u043b\u0438 (\u0441\u043c. \u043f\u0440\u0438\u043c\u0435\u0440). \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041e\u0434\u043d\u043e \u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0435 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$, \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0435\u0435 $50$. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0441\u043f\u0438\u0440\u0430\u043b\u044c. \u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c $0$. \u0422\u0435\u0441\u0442\u044b \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 [latex]7[\/latex] [latex]1111111 \\\\ 0000001 \\\\ 1111101 \\\\ 1000101 \\\\ 1011101 \\\\ 1000001 \\\\ 1111111[\/latex] [latex]1[\/latex] [latex]0[\/latex] [latex]3[\/latex] [latex]111 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3831\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":122,"featured_media":4232,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[443,444,445],"jetpack_featured_media_url":"https:\/\/java.mazurok.com\/wp-content\/uploads\/depositphotos_68110643-stock-illustration-volute-spiral-concentric-lines-pattern1.jpg","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3831"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/122"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3831"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3831\/revisions"}],"predecessor-version":[{"id":3832,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3831\/revisions\/3832"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/media\/4232"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}