{"id":4644,"date":"2018-12-27T20:38:53","date_gmt":"2018-12-27T17:38:53","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=4644"},"modified":"2018-12-27T23:16:06","modified_gmt":"2018-12-27T20:16:06","slug":"e-olymp-5082-%d1%81%d1%82%d0%b5%d0%bf%d0%b5%d0%bd%d0%b8-%d0%b2%d0%b5%d1%80%d1%88%d0%b8%d0%bd","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=4644","title":{"rendered":"e-olymp 5082. \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0435\u0440\u0448\u0438\u043d"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u0414\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0435\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0435\u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c.<\/p>\n<p><strong>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e $N\u00a0(1\u00a0\u2264\u00a0N\u00a0\u2264\u00a01000)$. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 $N$\u00a0\u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441\u043c\u0435\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><strong>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/p>\n<p>\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 $N$\u00a0\u0447\u0438\u0441\u0435\u043b \u2013 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u0448\u0438\u043d.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u044b<\/h2>\n<table style=\"width: 553px\">\n<tbody>\n<tr>\n<td style=\"width: 276px\">\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td style=\"width: 261px\">\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 276px\">2<br \/>\n0 1<br \/>\n1 0<\/td>\n<td style=\"width: 261px\">1 1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 276px\">3<br \/>\n0 1 0<br \/>\n1 0 1<br \/>\n0 1 0<\/td>\n<td style=\"width: 261px\">1 2 1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 276px\">5<br \/>\n1 1 1 1 1<br \/>\n1 0 0 0 0<br \/>\n1 1 1 1 1<br \/>\n1 0 0 0 0<br \/>\n1 1 1 1 1<\/td>\n<td style=\"width: 261px\">6 1 6 1 6<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 276px\">5<br \/>\n1 0 0 0 1<br \/>\n0\u00a01\u00a00 1\u00a00<br \/>\n0 0 1 0 0<br \/>\n0 0 1\u00a00 0<br \/>\n0 0 1 0 0<\/td>\n<td style=\"width: 261px\">3 3 2 1 1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h2>\n<pre class=\"lang:java decode:true \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\nclass Main\r\n{\r\n\tstatic StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\r\n\tstatic PrintWriter out = new PrintWriter(System.out);\r\n\tstatic int nextInt() throws IOException  {\r\n\t\tin.nextToken();\r\n\t\treturn (int)in.nval;\r\n\t}\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tint n = nextInt();\r\n\t\tfor (int i = 0; i &lt; n; i++) {\r\n\t\t\tint counter = 0, x;\r\n\t\t\tfor (int j = 0; j &lt; n; j++) {\r\n\t\t\t\tx = nextInt();\r\n\t\t\t\tif (x &gt; 0) counter += (i == j ? 2 : 1);\r\n\t\t\t}\r\n\t\t\tout.print (counter + \" \");\r\n\t\t\tout.flush();\r\n\t\t}\r\n\t}\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f $N$\u00a0\u0440\u0430\u0437, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b.\u00a0\u0425\u0440\u0430\u043d\u0438\u043c\u00a0\u043e\u0442\u0432\u0435\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <span class=\"lang:java decode:true  crayon-inline \">counter<\/span>\u00a0, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e $0$. \u041f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0435\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438, \u0435\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0440\u0430\u0432\u0435\u043d $1$, \u0442\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u044f\u043b\u0435\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 $2$, \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 (\u0442.\u043a. \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0435\u0442\u043b\u044f, \u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0440\u0435\u0431\u0440\u043e-\u043f\u0435\u0442\u043b\u044f \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b), \u0438\u043d\u0430\u0447\u0435 \u2014 $2$. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u00a0<a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/5082\">e-olymp.com<br \/>\n<\/a>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u00a0<a href=\"https:\/\/ideone.com\/QBCMmT\">ideone.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0414\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0435\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0435\u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e $N\u00a0(1\u00a0\u2264\u00a0N\u00a0\u2264\u00a01000)$. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 $N$\u00a0\u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441\u043c\u0435\u0436\u043d\u043e\u0441\u0442\u0438. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 $N$\u00a0\u0447\u0438\u0441\u0435\u043b \u2013 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u0448\u0438\u043d. \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 2 0 1 1 0 1 1 3 0 1 0 1 0 1 0 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=4644\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":121,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[109],"tags":[142,143],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4644"}],"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\/121"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4644"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4644\/revisions"}],"predecessor-version":[{"id":4650,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4644\/revisions\/4650"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}