{"id":5226,"date":"2020-09-21T21:36:33","date_gmt":"2020-09-21T18:36:33","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=5226"},"modified":"2020-11-25T12:16:42","modified_gmt":"2020-11-25T09:16:42","slug":"e-olymp-8254-%d0%bd%d0%be%d0%bc%d0%b5%d1%80%d0%b0-%d0%be%d1%82%d0%b5%d0%bb%d1%8f","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=5226","title":{"rendered":"e-olymp 8254. \u041d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442\u0435\u043b\u044f"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u041e\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 $n$ \u044d\u0442\u0430\u0436\u0435\u0439. \u041b\u043e\u0431\u0431\u0438, \u0440\u0435\u0441\u0442\u043e\u0440\u0430\u043d \u0438 \u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u043d\u044b\u0439 \u0437\u0430\u043b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u0436\u0435. \u041d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u043e 2-\u0433\u043e \u043f\u043e $n$-\u044b\u0439 \u044d\u0442\u0430\u0436\u0438. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u0436\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e $m$ \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043c\u0435\u0449\u0430\u0435\u0442 3 \u0433\u043e\u0441\u0442\u044f, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u0430\u0445 \u043e\u0442\u0435\u043b\u044f?<\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0414\u0432\u0430 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 $n$ \u0438 $m$ ($n, m\\leqslant10^6$).<\/p>\n<h1>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u0430\u0445 \u043e\u0442\u0435\u043b\u044f.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table style=\"height: 204px\" border=\"1\" width=\"638\">\n<tbody>\n<tr>\n<th>\u2116<\/th>\n<th>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/th>\n<th>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>5 10<\/td>\n<td>120<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>3 1<\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>2 5<\/td>\n<td>15<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>7 2<\/td>\n<td>36<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>20001 450000<\/td>\n<td>270000000000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434<\/h1>\n<pre class=\"lang:java decode:true\" title=\"\u041a\u043e\u0434\">    import java.util. * ;\r\n    import java.lang. * ;\r\n    import java.io. * ;\r\n     \r\n    class Main {\r\n      public static void main(String[] args) {\r\n        Scanner sc = new Scanner(System. in );\r\n        long n = sc.nextInt(); \/\/ \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u044d\u0442\u0430\u0436\u0435\u0439\r\n        long m = sc.nextInt(); \/\/ \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u0442\u0430\u0436\u0435\r\n        long ans = (n - 1) * m * 3; \/\/ \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439 \u0432 \u043e\u0442\u0435\u043b\u0435 \r\n        System.out.print(ans); \/\/ \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043e\u0442\u0432\u0435\u0442\r\n      }\r\n    }\r\n<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 $(n-1) \\cdot m \\cdot 3$, \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u0437 \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0430\u0436\u0435\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430, \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u0430\u0436\u0435\u0439, \u0442\u0440\u0435\u0442\u0438\u0439 &#8212; \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043d\u043e\u043c\u0435\u0440\u0435. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u0436\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0430\u0436\u0435\u0439 \u0432 \u043e\u0442\u0435\u043b\u0435.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/8254\">e-olymp<\/a><br \/>\n\u041a\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 <a href=\"https:\/\/www.ideone.com\/zU8ARk\">ideone<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u041e\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 $n$ \u044d\u0442\u0430\u0436\u0435\u0439. \u041b\u043e\u0431\u0431\u0438, \u0440\u0435\u0441\u0442\u043e\u0440\u0430\u043d \u0438 \u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u043d\u044b\u0439 \u0437\u0430\u043b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u0436\u0435. \u041d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u043e 2-\u0433\u043e \u043f\u043e $n$-\u044b\u0439 \u044d\u0442\u0430\u0436\u0438. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u0436\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e $m$ \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043c\u0435\u0449\u0430\u0435\u0442 3 \u0433\u043e\u0441\u0442\u044f, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u0430\u0445 \u043e\u0442\u0435\u043b\u044f? \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0414\u0432\u0430 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 $n$ \u0438 $m$ ($n, &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=5226\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":175,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[732,146,733],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5226"}],"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\/175"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5226"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5226\/revisions"}],"predecessor-version":[{"id":5227,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5226\/revisions\/5227"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}