{"id":4004,"date":"2018-12-09T13:40:17","date_gmt":"2018-12-09T10:40:17","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=4004"},"modified":"2018-12-25T20:15:06","modified_gmt":"2018-12-25T17:15:06","slug":"e-olymp-7368-%d1%81%d1%80%d0%b5%d0%b4%d0%bd%d0%b8%d0%b9-%d0%b1%d0%b0%d0%bb%d0%bb-%d0%b4%d0%bb%d1%8f-%d1%84%d0%b8%d0%b3%d1%83%d1%80%d0%b8%d1%81%d1%82%d0%be%d0%b2","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=4004","title":{"rendered":"e-olymp 7368. \u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0431\u0430\u043b\u043b \u0434\u043b\u044f \u0444\u0438\u0433\u0443\u0440\u0438\u0441\u0442\u043e\u0432"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4009 aligncenter\" src=\"http:\/\/java.mazurok.com\/wp-content\/uploads\/1127571237-300x195.jpg\" alt=\"\" width=\"308\" height=\"200\" srcset=\"https:\/\/java.mazurok.com\/wp-content\/uploads\/1127571237-300x195.jpg 300w, https:\/\/java.mazurok.com\/wp-content\/uploads\/1127571237-768x498.jpg 768w, https:\/\/java.mazurok.com\/wp-content\/uploads\/1127571237-1024x664.jpg 1024w, https:\/\/java.mazurok.com\/wp-content\/uploads\/1127571237.jpg 1167w\" sizes=\"(max-width: 308px) 100vw, 308px\" \/><br \/>\n\u0421\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u0430\u043c-\u0444\u0438\u0433\u0443\u0440\u0438\u0441\u0442\u0430\u043c [latex]n[\/latex] \u0441\u0443\u0434\u0435\u0439 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0446\u0435\u043d\u043a\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u043d\u0438\u043a \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0438\u0437\u044b\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0432\u0441\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438, \u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u043b\u043b\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u043e\u043c. \u041d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u043b\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u0430.<\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0432\u0430 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0443\u0434\u0435\u0439 [latex]n[\/latex] \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u043e\u0432 [latex]m[\/latex]. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 [latex]m[\/latex] \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f [latex]n[\/latex] \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u2013 \u043e\u0446\u0435\u043d\u043a\u0438 \u0432\u0441\u0435\u0445 \u0441\u0443\u0434\u0435\u0439 [latex](0 &lt; n \\leqslant 10, 0 &lt; m \\leqslant 100)[\/latex] \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0444\u0438\u0433\u0443\u0440\u0438\u0441\u0442\u043e\u0432.<\/p>\n<h1>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 [latex]m[\/latex] \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u0434\u0432\u0443\u0445 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 &#8212; \u0431\u0430\u043b\u043b \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u0430.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table>\n<tbody>\n<tr>\n<th>#<\/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 4<br \/>\n7 8 9 8 10<br \/>\n6 5 5 4 7<br \/>\n9 9 10 7 7<br \/>\n7 7 10 9 8<\/td>\n<td>8.33 5.33 9.00 8.50<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>6 3<br \/>\n6 7 6 5 4 3<br \/>\n9 8 5 5 6 5<br \/>\n7 6 4 1 2 2<\/td>\n<td>5.25 7.00 3.50<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>4 5<br \/>\n6 7 8 6<br \/>\n9 8 5 4<br \/>\n7 6 7 5<br \/>\n4 3 9 3<br \/>\n7 8 7 6<\/td>\n<td>7.00 6.50 6.00 4.00 7.00<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>4 4<br \/>\n7 7 2 3<br \/>\n9 8 3 3<br \/>\n5 4 9 7<br \/>\n4 3 2 6<\/td>\n<td>3.00 8.00 6.00 3.50<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>8 5<br \/>\n4 5 6 7 7 4 9 8<br \/>\n3 5 6 6 7 8 5 9<br \/>\n7 6 3 9 3 7 9 7<br \/>\n5 6 4 3 7 7 5 7<br \/>\n9 8 4 6 7 9 9 4<\/td>\n<td>6.60 6.17 6.75 5.00 7.00<\/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 \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\npublic class Main\r\n{\r\n  public static void main (String[] args) throws java.lang.Exception\r\n  {\r\n    double n, m;\r\n    double x, min = 100, max = -100, sum = 0, a = 0, b = 0;\r\n    Scanner in = new Scanner(System.in);\r\n    n = in.nextDouble();\r\n    m = in.nextDouble();\r\n    for (int i = 0; i &lt; m; i++){\r\n      for (int j = 0; j &lt; n; j ++){\r\n        x = in.nextDouble();\r\n        if (max == x) a++;\r\n        if (max &lt; x) {\r\n          if (max != min) sum += a*max;\r\n          a = 1;\r\n          max = x;\r\n        }\r\n        if ( min == x) b++;\r\n        if (min &gt; x) {\r\n          if (max != min) sum += b*min;\r\n          b = 1;\r\n          min = x;\r\n        }\r\n      if (x!= min &amp;&amp; x != max) sum += x;\r\n      }\r\n      if(i == m-1) System.out.printf(\"%.2f\", sum \/ (n - a - b));\r\n      else System.out.printf(\"%.2f \", sum \/ (n - a - b));\r\n      sum = a = b = 0;\r\n      min = 100;\r\n      max = -100;\r\n    }\r\n  }\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h1>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u044a\u044f\u0442\u044c \u0432\u0441\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 [latex]a[\/latex] \u0438 [latex]b[\/latex] \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0411\u0435\u0440\u0435\u043c \u043b\u044e\u0431\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 [latex]x,[\/latex] \u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439. \u0414\u0430\u043b\u0435\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438 \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0415\u0449\u0451 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 [latex]n &#8212; a &#8212; b.[\/latex] \u0410 \u0437\u0430\u0442\u0435\u043c \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 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 [latex]\\displaystyle\\frac{sum}{n &#8212; a &#8212; b}[\/latex] \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/7368\" rel=\"noopener\" target=\"_blank\">e-olymp<\/a><\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <a href=\"https:\/\/ideone.com\/JCU6ep\" rel=\"noopener\" target=\"_blank\">ideone<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0421\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u0430\u043c-\u0444\u0438\u0433\u0443\u0440\u0438\u0441\u0442\u0430\u043c [latex]n[\/latex] \u0441\u0443\u0434\u0435\u0439 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0446\u0435\u043d\u043a\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u043d\u0438\u043a \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0438\u0437\u044b\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0432\u0441\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438, \u0430 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0446\u0435\u043d\u043e\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u043b\u043b\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u043e\u043c. \u041d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u043b\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u0430. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0432\u0430 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0443\u0434\u0435\u0439 [latex]n[\/latex] \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043f\u043e\u0440\u0442\u0441\u043c\u0435\u043d\u043e\u0432 [latex]m[\/latex]. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 [latex]m[\/latex] &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=4004\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":123,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[506,505,137,503,504,304],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4004"}],"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\/123"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4004"}],"version-history":[{"count":14,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4004\/revisions"}],"predecessor-version":[{"id":4035,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4004\/revisions\/4035"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}