{"id":5097,"date":"2020-09-14T21:37:45","date_gmt":"2020-09-14T18:37:45","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=5097"},"modified":"2020-11-25T12:01:38","modified_gmt":"2020-11-25T09:01:38","slug":"e-olymp-8352-%d1%82%d0%b0%d0%ba%d1%81%d0%b8","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=5097","title":{"rendered":"e-olymp 8352. \u0422\u0430\u043a\u0441\u0438"},"content":{"rendered":"<h1>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h1>\n<p>\u0412 \u0447\u0430\u0441 \u043f\u0438\u043a \u043d\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0438 \u0442\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043d\u044b\u0445 \u0442\u0430\u043a\u0441\u0438, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0443\u0442 \u0436\u0435 \u043d\u0430\u0431\u0438\u043b\u0438\u0441\u044c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u044b. \u0412\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0430\u0445 \u0440\u0430\u0437\u043d\u043e\u0435, \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u0440\u043e\u0432\u043d\u0443 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0422\u0440\u0438 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430, \u043d\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 $100$\u00a0&#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439, \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0430\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<h3>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e &#8212; \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u043e\u0432\u043e\u00a0<strong>IMPOSSIBLE<\/strong> (\u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438).<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table>\n<tbody>\n<tr>\n<td width=\"80\">\u2116<\/td>\n<td width=\"319\">\u0412\u0432\u043e\u0434<\/td>\n<td width=\"319\">\u0412\u044b\u0432\u043e\u0434<\/td>\n<\/tr>\n<tr>\n<td width=\"80\">1<\/td>\n<td width=\"319\">1 2 3<\/td>\n<td width=\"319\">1<\/td>\n<\/tr>\n<tr>\n<td width=\"80\">2<\/td>\n<td width=\"319\">6 7 4<\/td>\n<td width=\"319\">IMPOSSIBLE<\/td>\n<\/tr>\n<tr>\n<td width=\"80\">3<\/td>\n<td width=\"319\">18 10 2<\/td>\n<td width=\"319\">8<\/td>\n<\/tr>\n<tr>\n<td width=\"80\">4<\/td>\n<td width=\"319\">54 10 96<\/td>\n<td width=\"319\">IMPOSSIBLE<\/td>\n<\/tr>\n<tr>\n<td width=\"80\">5<\/td>\n<td width=\"319\">27 27 27<\/td>\n<td width=\"319\">0<\/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\">class Main\r\n{\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tjava.util.Scanner i = new java.util.Scanner(System.in);\r\n\t\tint b1 = i.nextInt();\r\n\t\tint b2 = i.nextInt();\r\n\t\tint b3 = i.nextInt();\r\n\t\tif ((b1 + b2 + b3) % 3 != 0) {\r\n\t\t\tSystem.out.println(\"IMPOSSIBLE\");\r\n\t\t}\r\n\t\telse {\r\n\t\t\tint average; \/\/ \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435\r\n\t\t\tint count = 0; \/\/ \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c\r\n\t\t\taverage = (b1 + b2 + b3) \/ 3;\r\n\t\t\tif (b1 &gt; average) count += b1 - average;\r\n\t\t\tif (b2 &gt; average) count += b2 - average;\r\n\t\t\tif (b3 &gt; average) count += b3 - average;\r\n\t\t\tSystem.out.println(count);\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u041c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u0441\u0430\u0434\u0438\u0442\u044c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u043e\u0440\u043e\u0432\u043d\u0443 \u0432 \u0442\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0442\u043d\u043e \u0442\u0440\u0435\u043c. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u043b\u043e\u0432\u043e IMPOSSIBLE.<\/p>\n<p>\u0418\u043d\u0430\u0447\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0438 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435: $\\frac{b_{1}+b_{2}+b_{3}}{3}$ \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0441\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432, \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<ul style=\"list-style-type: square\">\n<li><a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/8352\">\u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/a><\/li>\n<li><a href=\"https:\/\/ideone.com\/TuhRkn\">\u041a\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/a><\/li>\n<li><a href=\"https:\/\/www.e-olymp.com\/ru\/submissions\/7298083\">\u0417\u0430\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0412 \u0447\u0430\u0441 \u043f\u0438\u043a \u043d\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0438 \u0442\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043d\u044b\u0445 \u0442\u0430\u043a\u0441\u0438, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0443\u0442 \u0436\u0435 \u043d\u0430\u0431\u0438\u043b\u0438\u0441\u044c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u044b. \u0412\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0430\u0445 \u0440\u0430\u0437\u043d\u043e\u0435, \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043a\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u0440\u043e\u0432\u043d\u0443 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0441\u0430\u0434\u0438\u0442\u044c. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=5097\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":176,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[706,707,304],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5097"}],"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\/176"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5097"}],"version-history":[{"count":3,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5097\/revisions"}],"predecessor-version":[{"id":5115,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5097\/revisions\/5115"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}