{"id":947,"date":"2016-07-06T11:41:58","date_gmt":"2016-07-06T08:41:58","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=947"},"modified":"2016-07-13T13:11:31","modified_gmt":"2016-07-13T10:11:31","slug":"e-olymp-5082-degrees-of-vertices","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=947","title":{"rendered":"e-olymp 5082. Degrees of vertices"},"content":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u0437\u044f\u0442\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/www.e-olymp.com\/ru\/problems\/5082\" target=\"_blank\">e-olymp.com<\/a>.<\/p>\n<h1>\u0423\u0441\u043b\u043e\u0432\u0438\u0435<\/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<h2>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\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 <img decoding=\"async\" class=\"latex\" title=\"1 \\leq N \\leq 1000\" src=\"http:\/\/s0.wp.com\/latex.php?latex=1+%5Cleq+N+%5Cleq+1000&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"1 \\leq N \\leq 1000\" \/>.\u00a0\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 <img decoding=\"async\" class=\"latex\" title=\"N\" src=\"http:\/\/s0.wp.com\/latex.php?latex=N&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"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<h2>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 <img decoding=\"async\" class=\"latex\" title=\"N\" src=\"http:\/\/s0.wp.com\/latex.php?latex=N&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"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>\n<tbody>\n<tr>\n<td>\u0412\u0432\u043e\u0434<\/td>\n<td>\u0412\u044b\u0432\u043e\u0434<\/td>\n<\/tr>\n<tr>\n<td>2<br \/>\n0 1<br \/>\n1 0<\/td>\n<td>1 1<\/td>\n<\/tr>\n<tr>\n<td>\u00a03<br \/>\n0 1 0<br \/>\n1 0 1<br \/>\n0 1 0<\/td>\n<td>\u00a01 2 1<\/td>\n<\/tr>\n<tr>\n<td>\u00a03<br \/>\n0 1 0<br \/>\n1 1\u00a01<br \/>\n0 1 0<\/td>\n<td>1 4 1<\/td>\n<\/tr>\n<tr>\n<td>\u00a05<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>\u00a06 1 6 1 6<\/td>\n<\/tr>\n<tr>\n<td>\u00a05<br \/>\n0 0 1 0 0<br \/>\n0 1 0 1 0<br \/>\n0 1 1 1 0<br \/>\n0 1 0 1 0<br \/>\n1 0 0 0 1<\/td>\n<td>\u00a01 3 4 3 3<\/td>\n<\/tr>\n<tr>\n<td>\u00a05<br \/>\n0 1 1 1 1<br \/>\n1 0 0 0 0<br \/>\n0 1 1 1 0<br \/>\n0 0 0 0 1<br \/>\n1 1 1 1 0<\/td>\n<td>\u00a04 1 4 1 4<\/td>\n<\/tr>\n<tr>\n<td>\u00a05<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>\u00a03 3 2 1 1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434 \u043d\u0430 Java:<\/h1>\n<pre class=\"scroll:true lang:java decode:true \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\nclass Main\r\n{\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tint N;\r\n\t\tScanner scan = new Scanner(System.in);\r\n\t\tN = scan.nextInt();\r\n\t\tString strout = new String();\r\n\t\tfor (int i = 0; i &lt; N; i++) {\r\n\t\t\tint counter = 0;\r\n\t\t\tint x;\r\n\t\t\tfor (int j = 0; j &lt; N; j++) {\r\n\t\t\t\tx = scan.nextInt();\r\n\t\t\t\tif (x &gt; 0) counter += (i == j? 2 : 1);\r\n\t\t\t}\r\n\t\t\tstrout += counter + \" \";\r\n\t\t}\r\n\t\tSystem.out.print(strout);\r\n\t}\r\n}<\/pre>\n<h1>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/h1>\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\u00a0<img decoding=\"async\" class=\"latex\" title=\"N\" src=\"http:\/\/s0.wp.com\/latex.php?latex=N&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"N\" \/> \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 <img decoding=\"async\" class=\"latex\" title=\"counter\" src=\"http:\/\/s0.wp.com\/latex.php?latex=counter&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"counter\" \/>, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e <img decoding=\"async\" class=\"latex\" title=\"0\" src=\"http:\/\/s0.wp.com\/latex.php?latex=0&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"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 <img decoding=\"async\" class=\"latex\" title=\"1\" src=\"http:\/\/s0.wp.com\/latex.php?latex=1&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"1\" \/>, \u0442\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0435\u043f\u0435\u043d\u0438 <img decoding=\"async\" class=\"latex\" title=\"2\" src=\"http:\/\/s0.wp.com\/latex.php?latex=2&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"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\u0430\u043a \u043a\u0430\u043a \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0442\u043b\u0435\u0439, \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 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u00a0<img decoding=\"async\" class=\"latex\" title=\"1\" src=\"http:\/\/s0.wp.com\/latex.php?latex=1&amp;bg=292625&amp;fg=b29d85&amp;s=0\" alt=\"1\" \/>. \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443-\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0435\u0451.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438:<\/h1>\n<p>\u0420\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Ideone.com:\u00a0<a href=\"http:\/\/ideone.com\/UI4i4V\">Ideone.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u0437\u044f\u0442\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430 e-olymp.com. \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \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 .\u00a0\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \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 \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\u0432\u043e\u0434 \u0412\u044b\u0432\u043e\u0434 2 0 1 1 0 1 1 \u00a03 0 1 0 1 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=947\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":86,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[142,143],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/947"}],"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\/86"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=947"}],"version-history":[{"count":11,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/947\/revisions"}],"predecessor-version":[{"id":1159,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/947\/revisions\/1159"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}