{"id":4962,"date":"2020-09-09T20:00:09","date_gmt":"2020-09-09T17:00:09","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=4962"},"modified":"2020-11-25T11:56:17","modified_gmt":"2020-11-25T08:56:17","slug":"e-olymp-8946-%d1%88%d0%b0%d0%b1%d0%bb%d0%be%d0%bd","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=4962","title":{"rendered":"e-olymp 8946. \u0428\u0430\u0431\u043b\u043e\u043d"},"content":{"rendered":"<h1>\u0423\u0441\u043b\u043e\u0432\u0438\u0435<\/h1>\n<p>\u041f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 $n$ \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c $n\\times n$, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430 \u0438 \u043f\u0440\u043e\u0431\u0435\u043b \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-32053 aligncenter\" src=\"http:\/\/cpp.mazurok.com\/wp-content\/uploads\/2020\/05\/forCPP.jpg\" alt=\"\" width=\"127\" height=\"128\" \/><\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u041e\u0434\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$.<\/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 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 $n\u00a0\\times\u00a0n$.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table>\n<tbody>\n<tr>\n<td>\u2116<\/td>\n<td style=\"text-align: left\">\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td style=\"text-align: left\">\u00a0\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">1<\/td>\n<td style=\"text-align: left\">2<\/td>\n<td>\n<pre class=\"\">* \r\n *<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>3<\/td>\n<td>\n<pre class=\"\">* *\r\n\r\n *\r\n\r\n* *<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>4<\/td>\n<td>\n<pre class=\"\">* *\r\n\r\n * *\r\n\r\n* *<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>5<\/td>\n<td>\n<pre class=\"\">* * *\r\n\r\n * *\r\n\r\n* * *\r\n\r\n * *\r\n\r\n* * *<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>6<\/td>\n<td>\n<pre class=\"\">* * *\r\n\r\n * * *\r\n\r\n* * *\r\n\r\n * * *\r\n\r\n* * *\r\n\r\n * * *<\/pre>\n<\/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 \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\nimport java.util.Scanner;\r\nclass Ideone\r\n{\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tlong n;\r\n    \tString s1 = \"\", s2 = \"\";\r\n    \tScanner myObj = new Scanner(System.in);\r\n    \tn = myObj.nextLong();\r\n\r\n    \tfor (int i = 0; i &lt; n; i++){\/\/\u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \r\n\t        if (i % 2 == 0){\r\n\t            s1 += \"*\";\r\n\t            s2 += \" \";\r\n\t        }\r\n\t        else {\r\n\t            s2 += \"*\";\r\n\t            s1 += \" \";\r\n\t        }\r\n\t    }\r\n\t    for (int i = 0; i &lt; n; i++){\r\n\t        if (i % 2 == 0){\/\/\u0432\u044b\u0432\u043e\u0434\u0438\u043c s1, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u0447\u0435\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440\r\n\t           System.out.println(s1);\r\n\t        }\r\n\t        else System.out.println(s2);\/\/\u0432\u044b\u0432\u043e\u0434\u0438\u043c s2, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440\r\n\t    }\r\n\t}\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0443\u0445 \u0432\u0438\u0434\u043e\u0432 \u0438 \u0442\u043e \u043f\u043e\u043e\u0447\u0435\u0440\u0451\u0434\u043d\u043e. \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0438\u0434 &#8212; \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f $\\ast$ \u0438 \u0437\u0430\u0442\u0435\u043c \u0447\u0435\u0440\u0435\u0434\u0443\u0435\u0442\u0441\u044f $\\ast$ \u0438 \u043f\u0440\u043e\u0431\u0435\u043b. \u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0438\u0434 &#8212; \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c \u0438 \u0437\u0430\u0442\u0435\u043c \u0447\u0435\u0440\u0435\u0434\u0443\u0435\u0442\u0441\u044f $\\ast$ \u0438 \u043f\u0440\u043e\u0431\u0435\u043b. \u041c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0430. \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043d\u0430\u043c \u0432\u0438\u0434\u0430, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432 \u0446\u0438\u043a\u043b\u0435.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 <a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/8946\" target=\"_blank\" rel=\"noopener noreferrer\">e-olymp<\/a><\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 <a href=\"https:\/\/ideone.com\/PIyH9P\" target=\"_blank\" rel=\"noopener noreferrer\">ideone<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u041f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 $n$ \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c $n\\times n$, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430 \u0438 \u043f\u0440\u043e\u0431\u0435\u043b \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041e\u0434\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 $n\u00a0\\times\u00a0n$. \u0422\u0435\u0441\u0442\u044b \u2116 \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u00a0\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 1 2 * * 2 3 * * * * * 3 4 * * * * * &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=4962\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":142,"featured_media":5074,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[689,75],"jetpack_featured_media_url":"https:\/\/java.mazurok.com\/wp-content\/uploads\/forCPP1.jpg","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4962"}],"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\/142"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4962"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4962\/revisions"}],"predecessor-version":[{"id":4963,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4962\/revisions\/4963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/media\/5074"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}