{"id":5390,"date":"2020-12-06T17:54:13","date_gmt":"2020-12-06T14:54:13","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=5390"},"modified":"2020-12-07T19:38:08","modified_gmt":"2020-12-07T16:38:08","slug":"e-olymp-9531-%d0%ba%d0%be%d0%bc%d0%bf%d0%bb%d0%b5%d0%ba%d1%81%d0%bd%d1%8b%d0%b5-%d1%87%d0%b8%d1%81%d0%bb%d0%b0-%d1%81%d0%bb%d0%be%d0%b6%d0%b5%d0%bd%d0%b8%d0%b5-%d0%b8-%d0%b2%d1%8b%d1%87%d0%b8%d1%82","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=5390","title":{"rendered":"e-olymp 9531. \u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430: \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435"},"content":{"rendered":"<h1>\u0423\u0441\u043b\u043e\u0432\u0438\u0435<\/h1>\n<p>\u0414\u0430\u043d\u044b \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0438\u0445 \u0441\u0443\u043c\u043c\u0443 \u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h2>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u0434\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 $a+bi$ \u0438\u043b\u0438 $a &#8212; bi$, \u0433\u0434\u0435 $a$ \u0446\u0435\u043b\u043e\u0435, $b$ \u0446\u0435\u043b\u043e\u0435 \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438 \u043c\u043d\u0438\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 $10^{9}$.<\/p>\n<h2>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0442\u0432\u0435\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table style=\"height: 354px\" width=\"1311\">\n<tbody>\n<tr>\n<td style=\"text-align: center\" width=\"40\">\n<h4>\u2116<\/h4>\n<\/td>\n<td style=\"text-align: center\" width=\"350\">\n<h4>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<\/td>\n<td style=\"text-align: center\" width=\"350\">\n<h4>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">1<\/td>\n<td style=\"text-align: center\">\n<div>2+3i + 7-4i<\/div>\n<\/td>\n<td style=\"text-align: center\">9-1i<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">2<\/td>\n<td style=\"text-align: center\">\n<div>-1-1i &#8212; -1-1i<\/div>\n<\/td>\n<td style=\"text-align: center\">0+0i<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">3<\/td>\n<td style=\"text-align: center\">56743+876i &#8212; 1234-124i<\/td>\n<td style=\"text-align: center\">55509+1000i<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\">4<\/td>\n<td style=\"text-align: center\">331+10i &#8212; 331+10i<\/td>\n<td style=\"text-align: center\">0+0i<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434<\/h1>\n<pre class=\"lang:java decode:true \">import java.util.*;\r\n \r\npublic class Main {\r\n    public static void main(String args[]) {\r\n        Scanner sc = new Scanner(System.in);\r\n        while (sc.hasNextLine()) {\r\n            String s[] = sc.nextLine().replace(\"i\", \"\").split(\" \");\r\n            int x1 = 1, x2 = 1;\r\n            if (s[0].charAt(0) == '-') {\r\n                s[0] = s[0].substring(1, s[0].length());\r\n                x1 *= -1;\r\n            }\r\n            if (s[0].indexOf(\"+\") != -1) {\r\n                x1 *= Integer.parseInt(s[0].split(\"\\\\+\")[0]);\r\n                x2 *= Integer.parseInt(s[0].split(\"\\\\+\")[1]);\r\n            } else {\r\n                x1 *= Integer.parseInt(s[0].split(\"-\")[0]);\r\n                x2 *= Integer.parseInt(s[0].split(\"-\")[1]) * (-1);\r\n            }\r\n            int y1 = 1, y2 = 1;\r\n            if (s[2].charAt(0) == '-') {\r\n                s[2] = s[2].substring(1, s[2].length());\r\n                y1 *= -1;\r\n            }\r\n            if (s[2].indexOf('+') != -1) {\r\n                y1 *= Integer.parseInt(s[2].split(\"\\\\+\")[0]);\r\n                y2 *= Integer.parseInt(s[2].split(\"\\\\+\")[1]);\r\n            } else {\r\n                y1 *= Integer.parseInt(s[2].split(\"-\")[0]);\r\n                y2 *= Integer.parseInt(s[2].split(\"-\")[1]) * (-1);\r\n            }\r\n            if (s[1].equals(\"+\")) {\r\n                x1 = x1 + y1;\r\n                x2 = x2 + y2;\r\n            } else {\r\n                x1 = x1 - y1;\r\n                x2 = x2 - y2;\r\n            }\r\n            String c = (x2 &gt;= 0 ? \"+\" : \"\");\r\n            System.out.printf(\"%d%s%di\\n\", x1, c, x2);\r\n        }\r\n    }\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <span id=\"crayon-5df425fb0a726605650550\" class=\"crayon-syntax crayon-syntax-inline crayon-theme-mirc-dark crayon-theme-mirc-dark-inline crayon-font-monospace\" style=\"font-size: 12px !important;line-height: 15px !important\"><span class=\"crayon-pre crayon-code\" style=\"font-size: 12px !important;line-height: 15px !important\"><span class=\"crayon-e\">.split()<\/span><\/span><\/span> \u0442\u043e\u0433\u0434\u0430, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439  \u0441\u0442\u0440\u043e\u043a\u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0435\u0451 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a, \u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b &#8212; \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u0430\u044f \u043d\u0430\u0434 \u043d\u0438\u043c\u0438. \u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u0442\u0430\u043a \u0436\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <span id=\"crayon-5df425fb0a726605650550\" class=\"crayon-syntax crayon-syntax-inline crayon-theme-mirc-dark crayon-theme-mirc-dark-inline crayon-font-monospace\" style=\"font-size: 12px !important;line-height: 15px !important\"><span class=\"crayon-pre crayon-code\" style=\"font-size: 12px !important;line-height: 15px !important\"><span class=\"crayon-e\">.split()<\/span><\/span><\/span>, \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0438 \u043c\u043d\u0438\u043c\u0443\u044e \u0447\u0430\u0441\u0442\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.  <\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p><a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/9531\">E-olymp<\/a><\/p>\n<p><a href=\"https:\/\/ideone.com\/juuJNC\">Ideone<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0414\u0430\u043d\u044b \u0434\u0432\u0430 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0438\u0445 \u0441\u0443\u043c\u043c\u0443 \u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u0434\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 $a+bi$ \u0438\u043b\u0438 $a &#8212; bi$, \u0433\u0434\u0435 $a$ \u0446\u0435\u043b\u043e\u0435, $b$ \u0446\u0435\u043b\u043e\u0435 \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438 \u043c\u043d\u0438\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 $10^{9}$. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=5390\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":170,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[484,181,448,646,568],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5390"}],"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\/170"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5390"}],"version-history":[{"count":7,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5390\/revisions"}],"predecessor-version":[{"id":5398,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5390\/revisions\/5398"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}