{"id":3935,"date":"2018-12-02T23:10:32","date_gmt":"2018-12-02T20:10:32","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3935"},"modified":"2018-12-25T20:03:23","modified_gmt":"2018-12-25T17:03:23","slug":"e-olymp-8288-%d0%be%d0%bb%d0%b8%d0%bc%d0%bf%d0%b8%d0%b0%d0%b4%d0%b0-%d0%bf%d0%be-%d0%bf%d1%80%d0%be%d0%b3%d1%80%d0%b0%d0%bc%d0%bc%d0%b8%d1%80%d0%be%d0%b2%d0%b0%d0%bd%d0%b8%d1%8e","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3935","title":{"rendered":"e-olymp 8288. \u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0430 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e"},"content":{"rendered":"<h1>\u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0430 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/h1>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-22259 size-medium alignright jetpack-lazy-image\" src=\"https:\/\/i2.wp.com\/cpp.mazurok.com\/wp-content\/uploads\/2017\/12\/\u0411\u0435\u0437-\u0438\u043c\u0435\u043d\u0438-2.png?resize=300%2C300\" alt=\"\" width=\"300\" height=\"300\" \/>\u041d\u0430 \u0410\u0421\u041c-\u043e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0443 \u043f\u0440\u0438\u0431\u044b\u043b\u043e [latex]N[\/latex] \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b \u0436\u0443\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438, \u0447\u0442\u043e [latex]A[\/latex] \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0430 C\u0438, [latex]B[\/latex] \u043d\u0430 Python, [latex]C[\/latex] \u043d\u0430 Pascal, [latex]X[\/latex] \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u044e\u0442 C\u0438 \u0438 Python, [latex]Y[\/latex] \u2014 Python \u0438 Pascal, [latex]Z[\/latex] \u2014 C\u0438 \u0438 Pascal. \u0418\u043c\u0435\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f [latex]N, A, B, C, X, Y, Z[\/latex] \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0430 \u0442\u0440\u0451\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h2>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0441\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b [latex]N, A, B, C, X, Y, Z[\/latex] \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 [latex]100[\/latex].<\/p>\n<h2>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0430 \u0442\u0440\u0451\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h2>\u0422\u0435\u0441\u0442\u044b<\/h2>\n<table style=\"height: 169px\" width=\"453\">\n<tbody>\n<tr>\n<th>#<\/th>\n<th>\u0412\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/th>\n<th>\u0412\u042b\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/th>\n<\/tr>\n<tr>\n<th>1<\/th>\n<th>100 40 50 60 15 20 25<\/th>\n<th>10<\/th>\n<\/tr>\n<tr>\n<th>2<\/th>\n<th>100 50 60 60 20 40 25<\/th>\n<th>15<\/th>\n<\/tr>\n<tr>\n<th>3<\/th>\n<th>80 50 40 60 20 30 25<\/th>\n<th>5<\/th>\n<\/tr>\n<tr>\n<th>4<\/th>\n<th>80 50 40 60 0 0 0<\/th>\n<th>0<\/th>\n<\/tr>\n<tr>\n<th>5<\/th>\n<th>40 20 30 0 5 0 10<\/th>\n<th>5<\/th>\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\n \r\nclass Main\r\n{\r\n\tpublic static void main (String[] args)\r\n\t{\r\n\t\tScanner input = new Scanner(System.in);\r\n\t\tint n = input.nextInt();\r\n\t\tint a = input.nextInt();\r\n\t\tint b = input.nextInt();\r\n\t\tint c = input.nextInt();\r\n\t\tint x = input.nextInt();\r\n\t\tint y = input.nextInt();\r\n\t\tint z = input.nextInt();\r\n\t\tif (x + y + z == 0)\r\n\t\t{\r\n    \t     System.out.print(0);\r\n    \t}\r\n    \telse\r\n    \t{\r\n    \t     System.out.print((x + y + z) - (a + b + c - n));\r\n    \t}\r\n \r\n\t}\r\n}<\/pre>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/h2>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431 \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0447\u0438\u0441\u043b\u043e\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u044e\u0442 \u043f\u043e \u0434\u0432\u0430 \u044f\u0437\u044b\u043a\u0430 $(X + Y + Z)$, \u0438 \u0447\u0438\u0441\u043b\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f\u0437\u044b\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043b\u044e\u0434\u0435\u0439 (\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u0449\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u044f\u0437\u044b\u043a\u043e\u0432 \u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432) $(A + B + C \u2014 N)$. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043c\u044b \u043d\u0430\u0439\u0434\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e 3 \u044f\u0437\u044b\u043a\u0430. \u0415\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u042d\u0439\u043b\u0435\u0440\u0430-\u0412\u0435\u043d\u043d\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u0441\u0435\u043c\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u0418\u0437 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e:<\/p>\n<p>$\\begin {cases} x_1 &amp;+ &amp;x_2 &amp;+ &amp;x_3 &amp;+ &amp;x_4 &amp;+ &amp;x_5 &amp;+ &amp;x_6 &amp;+ &amp;x_7 &amp;=N \\newline x_1 &amp;+ &amp; &amp; &amp; &amp;&amp;x_4 &amp;+ &amp; &amp; &amp;x_6 &amp;+ &amp;x_7 &amp;=A \\newline &amp; &amp; &amp;&amp;x_3 &amp;+ &amp;x_4 &amp;+ &amp;x_5 &amp;+ &amp; &amp; &amp;x_7 &amp;=B\\newline &amp; &amp;x_2 &amp;+ &amp; &amp; &amp; &amp; &amp;x_5 &amp;+ &amp;x_6 &amp;+ &amp;x_7 &amp;=C \\newline &amp; &amp; &amp;&amp;&amp; &amp;x_4 &amp;&amp; &amp;&amp; &amp;+ &amp;x_7 &amp;=X \\newline &amp; &amp; &amp; &amp; &amp;&amp; &amp; &amp;x_5 &amp; &amp; &amp;+ &amp;x_7 &amp;=Y \\newline &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp;x_6 &amp;+ &amp;x_7 &amp;=Z \\end{cases}$<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0432 [latex]x_7[\/latex] \u043e\u0431\u043b\u0430\u0441\u0442\u0438 (\u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u043a\u0440\u0443\u0433\u043e\u0432). \u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e:<\/p>\n<p>$(X + Y + Z)-(A + B + C \u2014 N)=x_7$<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439 \u0437\u043d\u0430\u044e\u0449\u0438\u0445 \u0434\u0432\u0430 \u044f\u0437\u044b\u043a\u0430 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e $(X + Y + Z == 0)$, \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442, \u0447\u0442\u043e \u043b\u044e\u0434\u0435\u0439 \u0437\u043d\u0430\u044e\u0449\u0438\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0442\u0440\u0438 \u044f\u0437\u044b\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0442.<\/p>\n<ul>\n<li>\u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/8288\" target=\"_blank\" rel=\"noopener\">e-olymp<\/a><\/li>\n<li>\u041a\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 <a href=\"https:\/\/ideone.com\/silgCB\" target=\"_blank\" rel=\"noopener\">Ideone <\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0430 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u041d\u0430 \u0410\u0421\u041c-\u043e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u0443 \u043f\u0440\u0438\u0431\u044b\u043b\u043e [latex]N[\/latex] \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b \u0436\u0443\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438, \u0447\u0442\u043e [latex]A[\/latex] \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0430 C\u0438, [latex]B[\/latex] \u043d\u0430 Python, [latex]C[\/latex] \u043d\u0430 Pascal, [latex]X[\/latex] \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u043d\u0430\u044e\u0442 C\u0438 \u0438 Python, [latex]Y[\/latex] \u2014 Python \u0438 Pascal, [latex]Z[\/latex] \u2014 C\u0438 \u0438 Pascal. \u0418\u043c\u0435\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f [latex]N, A, B, C, X, Y, Z[\/latex] \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3935\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":133,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3935"}],"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\/133"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3935"}],"version-history":[{"count":4,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3935\/revisions"}],"predecessor-version":[{"id":4374,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3935\/revisions\/4374"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}