{"id":435,"date":"2015-12-05T22:58:59","date_gmt":"2015-12-05T19:58:59","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=435"},"modified":"2016-06-29T18:12:13","modified_gmt":"2016-06-29T15:12:13","slug":"segmented-array","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=435","title":{"rendered":"Segmented Array"},"content":{"rendered":"<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430<\/strong><\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0430 T, \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0449\u0443\u044e \u043a\u0430\u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043d\u0451\u043c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u044c\u0441\u044f \u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0436\u0451\u043d\u043d\u044b\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441 \u0437\u0430\u0434\u0430\u043d\u0438\u044f\u043c\u0438:<\/p>\n<table class=\" aligncenter\" border=\"1\">\n<tbody>\n<tr>\n<th rowspan=\"2\">Big<br \/>\narray<\/th>\n<th rowspan=\"2\">Small<br \/>\n|T|<\/th>\n<th colspan=\"4\">Often<\/th>\n<th rowspan=\"2\">Student<\/th>\n<\/tr>\n<tr>\n<td>get()<\/td>\n<td>set()<\/td>\n<td>indexOf()<\/td>\n<td>min()\/max()<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>\u0428\u0432\u0430\u043d\u0434\u0442<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<hr \/>\n<p><strong>\u0422\u0435\u0441\u0442<\/strong><\/p>\n<table style=\"height: 274px\" width=\"829\">\n<tbody>\n<tr>\n<td>input<\/td>\n<td>output<\/td>\n<\/tr>\n<tr>\n<td>set 2 2 H<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 3 3 E<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 4 5 L<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 6 6 O<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set8 8 W<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 9 9 O<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 10 10 R<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set\u00a0 11 11 L<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 12 12 D<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 13 13 !<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 14 14 !<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>set 15 15 !<\/td>\n<td>ok<\/td>\n<\/tr>\n<tr>\n<td>show<\/td>\n<td>segment#0 { null null H E }<br \/>\nsegment#1 { L L O null }<br \/>\nsegment#2 { W O R L }<br \/>\nsegment#3 { D ! ! ! }<\/td>\n<\/tr>\n<tr>\n<td>exit<\/td>\n<td>\u00a0 N\/A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/strong><\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043a\u0435\u0442 <em><strong>odessa.uni.imem.maxim<\/strong><\/em>:<\/p>\n<ol>\n<li>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u00a0<em><strong>SegmentedArray<\/strong><\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443<\/li>\n<li>\u041a\u043b\u0430\u0441\u0441 <em><strong>SegmentedArrayImpl, <\/strong><\/em>\u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/li>\n<li>\u041a\u043b\u0430\u0441\u0441 <em><strong>SegmentedArrayApp<\/strong><\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u0435\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 main \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/li>\n<\/ol>\n<p><em><strong>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/strong>\u00a0<strong>SegmentedArray<\/strong><\/em><\/p>\n<pre class=\"lang:java decode:true \" title=\"Segmented Array\">package odessa.uni.imem.maxim;\r\n\r\npublic interface SegmentedArray&lt;Comparable&gt;\r\n{\r\n   int indexOf(Comparable value, int fromIndex);\r\n   void set(int fromIndex, int toIndex, Comparable value);\r\n   Comparable min(int fromIndex, int toIndex);\r\n}<\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<ul>\n<li>indexOf &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/li>\n<li>set &#8212; \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435<\/li>\n<li>min &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435<\/li>\n<\/ul>\n<p><em><strong>\u041a\u043b\u0430\u0441\u0441 SegmentedArrayImpl<\/strong><\/em><\/p>\n<pre class=\"lang:java decode:true \" title=\"Segmented Array\">package odessa.uni.imem.maxim;\r\n\r\npublic class SegmentedArrayImpl&lt;Item extends Comparable&lt;Item&gt;&gt; implements SegmentedArray&lt;Item&gt;\r\n{\r\n   private int size;\r\n   private int segmentSize;\r\n   private Object[][] segments;\r\n\r\n   public SegmentedArrayImpl(int aSegmentSize, int aSegmentCount)\r\n   {\r\n      segmentSize = aSegmentSize;\r\n      size = segmentSize * aSegmentCount;\r\n\r\n      segments = new Object[aSegmentCount][segmentSize];\r\n   }\r\n\r\n   public int indexOf(Item value, int fromIndex)\r\n   {\r\n      if (fromIndex &gt;= size)\r\n      {\r\n         return -1;\r\n      }\r\n\r\n      int segmentIndex = findSegmentIndex(fromIndex);\r\n      int indexInSegment = fromIndex - segmentIndex * segmentSize;\r\n\r\n      while (segmentIndex &lt; segments.length)\r\n      {\r\n         \/\/ @SuppressWarnings(\"unchecked\")\r\n         if (((Item) (segments[segmentIndex][indexInSegment])).compareTo(value) == 0)\r\n         {\r\n            return segmentIndex * indexInSegment;\r\n         }\r\n\r\n         indexInSegment++;\r\n\r\n         if (indexInSegment == segmentSize)\r\n         {\r\n            indexInSegment = 0;\r\n            segmentIndex++;\r\n         }\r\n      }\r\n\r\n      return -1;\r\n   }\r\n\r\n   public void set(int fromIndex, int toIndex, Item value)\r\n   {\r\n      if (fromIndex &gt;= size || toIndex &gt;= size || fromIndex &gt; toIndex)\r\n      {\r\n         return;\r\n      }\r\n\r\n      int index = fromIndex;\r\n      int segmentIndex = findSegmentIndex(fromIndex);\r\n      int indexInSegment = fromIndex - segmentIndex * segmentSize;\r\n\r\n      while (segmentIndex &lt; segments.length &amp;&amp; index &lt;= toIndex)\r\n      {\r\n         \/\/ @SuppressWarnings(\"unchecked\")\r\n         segments[segmentIndex][indexInSegment] = value;\r\n         index++;\r\n         indexInSegment++;\r\n\r\n         if (indexInSegment == segmentSize)\r\n         {\r\n            indexInSegment = 0;\r\n            segmentIndex++;\r\n         }\r\n      }\r\n   }\r\n\r\n   public Item min(int fromIndex, int toIndex)\r\n   {\r\n      if (fromIndex &gt;= size || toIndex &gt;= size || fromIndex &gt; toIndex)\r\n      {\r\n         return null;\r\n      }\r\n\r\n      int index = fromIndex;\r\n      int segmentIndex = findSegmentIndex(fromIndex);\r\n      int indexInSegment = fromIndex - segmentIndex * segmentSize;\r\n      Item minimum = null;\r\n\r\n      while (segmentIndex &lt; segments.length &amp;&amp; index &lt; toIndex)\r\n      {\r\n         \/\/ @SuppressWarnings(\"unchecked\")\r\n         Item val = (Item) segments[segmentIndex][indexInSegment];\r\n         if (minimum == null || val.compareTo(minimum) &lt; 0)\r\n         {\r\n            minimum = val;\r\n         }\r\n\r\n         index++;\r\n         indexInSegment++;\r\n\r\n         if (indexInSegment == segmentSize)\r\n         {\r\n            indexInSegment = 0;\r\n            segmentIndex++;\r\n         }\r\n      }\r\n\r\n      return null;\r\n   }\r\n\r\n   \/\/ check if the absolute index falls into given segment index\r\n   private int compareIndexToSegment(int index, int segmentIndex)\r\n   {\r\n      int lowerIndex = segmentIndex * segmentSize;\r\n      int higherIndex = (segmentIndex + 1) * segmentSize - 1;\r\n\r\n      if (index &lt; lowerIndex) \/\/ index falls before segment\r\n      {\r\n         return -1;\r\n      }\r\n      else if (index &gt; higherIndex) \/\/ index falls after segment\r\n      {\r\n         return 1;\r\n      }\r\n\r\n      return 0;\r\n   }\r\n\r\n   \/\/ find segment that contains given absolute index using binary search\r\n   \/\/ in array\r\n   private int findSegmentIndex(int index)\r\n   {\r\n      int lo = 0; \/\/ lower segment index\r\n      int hi = segments.length - 1; \/\/ higher segment index\r\n\r\n      while (lo &lt;= hi)\r\n      {\r\n         int mid = lo + (hi - lo) \/ 2; \/\/ middle segment index\r\n         int cmp = compareIndexToSegment(index, mid);\r\n\r\n         if (cmp &lt; 0)\r\n         {\r\n            hi = mid - 1;\r\n         }\r\n         else if (cmp &gt; 0)\r\n         {\r\n            lo = mid + 1;\r\n         }\r\n         else if (cmp == 0)\r\n         {\r\n            return mid;\r\n         }\r\n      }\r\n\r\n      return lo;\r\n   }\r\n\r\n   public void show()\r\n   {\r\n      for (int i = 0; i &lt; segments.length; i++)\r\n      {\r\n         System.out.printf(\"segment#%d { \", i);\r\n\r\n         for (int j = 0; j &lt; segmentSize; j++)\r\n         {\r\n            System.out.print((Item) segments[i][j]);\r\n            System.out.print(\" \");\r\n         }\r\n\r\n         System.out.printf(\"}\\n\");\r\n      }\r\n   }\r\n\r\n}<\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em><strong>SegmentedArray<\/strong><\/em> \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ul>\n<li>\u0414\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434\u044b indexOf \u0438 max \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e<\/li>\n<\/ul>\n<p><em><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/strong><\/em><\/p>\n<p>\u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u0430\u043b\u0433\u043e\u0440\u0438n\u043c, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Segment_tree\" target=\"_blank\">Segmented Tree.<\/a><\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0437\u0430\u0434\u0430\u0447\u0438, \u043c\u0430\u0441\u0441\u0438\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u044b\u043e\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u044b\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 findSegmentIndex \u0438 compareIndexToSegment.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 &#8212; \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u0438\u0437 Coursera. \u0412\u043d\u0443\u0442\u0440\u0438 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 compareIndexToSegment \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c, \u0442. \u0435. \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043d\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u043e\u0434 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u0441 \u0446\u0435\u043b\u044c\u044e \u0435\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430.<\/p>\n<p><em><strong>\u041c\u0435\u0442\u043e\u0434\u044b \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/strong><\/em><\/p>\n<ul>\n<li>indexOf &#8212; \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c findSegmentIndex \u0438 \u0434\u0430\u043b\u0435\u0435 &#8212; \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u044d\u0442\u043e\u043c \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/li>\n<li>set &#8212; \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c findSegmentIndex, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u043d\u0435\u043c, \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432 \u043d\u0435\u043c.<\/li>\n<li>min &#8212; \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u0430\u043a \u0438 \u043c\u0435\u0442\u043e\u0434 set \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/li>\n<\/ul>\n<p><em><strong>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b<\/strong><\/em><\/p>\n<ul>\n<li>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 &#8212; \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 2 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 &#8212; \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/li>\n<li>compareIndexToSegment &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: -1 &#8212; \u0435\u0441\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0435\u0440\u0435\u0434 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c, 0 &#8212; \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, 1 &#8212; \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430<\/li>\n<li>findSegmentIndex &#8212; \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435<\/li>\n<li>show &#8212; \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0435\u0447\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e<\/li>\n<\/ul>\n<p><em><strong>\u041a\u043b\u0430\u0441\u0441 SegmentedArrayApp<\/strong><\/em><\/p>\n<pre class=\"lang:java decode:true\" title=\"Segmented Array\">package odessa.uni.imem.maxim;\r\n\r\nimport java.util.*;\r\n\r\npublic class SegmentedArrayApp\r\n{\r\n   public static Vector&lt;String&gt; parseTextToTokens(String text)\r\n   {\r\n      Vector&lt;String&gt; tokens = new Vector&lt;String&gt;();\r\n      StringTokenizer st = new StringTokenizer(text);\r\n\r\n      while (st.hasMoreTokens())\r\n      {\r\n         tokens.add(st.nextToken());\r\n      }\r\n\r\n      return tokens;\r\n   }\r\n\r\n   public static Integer strToInt(String s)\r\n   {\r\n      Integer x = null;\r\n      try\r\n      {\r\n         x = Integer.parseUnsignedInt(s);\r\n      }\r\n      catch (NumberFormatException e)\r\n      {\r\n      }\r\n\r\n      return x;\r\n   }\r\n\r\n   public static void main(String[] args)\r\n   {\r\n      SegmentedArrayImpl&lt;String&gt; storage = new SegmentedArrayImpl&lt;String&gt;(4, 4);\r\n\r\n      Scanner in = new Scanner(System.in);\r\n\r\n      for (;;)\r\n      {\r\n         String inputLine = in.nextLine();\r\n         if (inputLine.isEmpty())\r\n         {\r\n            continue;\r\n         }\r\n\r\n         String cmd = null;\r\n         String arg1 = null;\r\n         String arg2 = null;\r\n         String arg3 = null;\r\n\r\n         {\r\n            Vector&lt;String&gt; inputTokens = parseTextToTokens(inputLine);\r\n            if (inputTokens.size() &gt; 0)\r\n            {\r\n               cmd = inputTokens.get(0);\r\n            }\r\n            if (inputTokens.size() &gt; 1)\r\n            {\r\n               arg1 = inputTokens.get(1);\r\n            }\r\n            if (inputTokens.size() &gt; 2)\r\n            {\r\n               arg2 = inputTokens.get(2);\r\n            }\r\n            if (inputTokens.size() &gt; 3)\r\n            {\r\n               arg3 = inputTokens.get(3);\r\n            }\r\n         }\r\n\r\n         if (cmd.equals(\"exit\"))\r\n         {\r\n            break;\r\n         }\r\n         else if (cmd.equals(\"show\"))\r\n         {\r\n            storage.show();\r\n         }\r\n         else if (cmd.equals(\"index\"))\r\n         {\r\n            String value = (arg1 != null &amp;&amp; !arg1.isEmpty()) ? arg1 : null;\r\n            Integer fromIndex = (arg2 != null) ? strToInt(arg2) : null;\r\n\r\n            if (value == null || fromIndex == null)\r\n            {\r\n               System.out.printf(\"*** ERROR: wrong arguments: &lt;%s&gt; &lt;%s&gt; &lt;%d&gt;\\n\", cmd, arg1, arg2);\r\n               continue;\r\n            }\r\n\r\n            System.out.println(storage.indexOf(value, fromIndex));\r\n         }\r\n         else if (cmd.equals(\"set\"))\r\n         {\r\n            Integer fromIndex = (arg1 != null) ? strToInt(arg1) : null;\r\n            Integer toIndex = (arg2 != null) ? strToInt(arg2) : null;\r\n            String value = (arg3 != null &amp;&amp; !arg3.isEmpty()) ? arg3 : null;\r\n\r\n            if (fromIndex == null || toIndex == null || value == null)\r\n            {\r\n               System.out.printf(\"*** ERROR: wrong arguments: &lt;%s&gt; &lt;%d&gt; &lt;%d&gt; &lt;%s&gt;\\n\", cmd, arg1, arg2, arg3);\r\n               continue;\r\n            }\r\n\r\n            storage.set(fromIndex, toIndex, value);\r\n            System.out.println(\"Ok\");\r\n         }\r\n         else if (cmd.equals(\"min\"))\r\n         {\r\n            Integer fromIndex = (arg1 != null) ? strToInt(arg1) : null;\r\n            Integer toIndex = (arg2 != null) ? strToInt(arg2) : null;\r\n\r\n            if (fromIndex == null || toIndex == null)\r\n            {\r\n               System.out.printf(\"*** ERROR: wrong arguments: &lt;%s&gt; &lt;%d&gt; &lt;%d&gt;\\n\", cmd, arg1, arg2);\r\n               continue;\r\n            }\r\n\r\n            System.out.println(storage.min(fromIndex, toIndex));\r\n         }\r\n\r\n      }\r\n\r\n      in.close();\r\n\r\n   }\r\n\r\n}<\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0432\u043e\u0434\u0430 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e main, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p><em><strong>\u041c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430<\/strong><\/em><\/p>\n<ol>\n<li>parseTextToTokens &#8212; \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0441\u043b\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 StringTokenizer \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u043b\u043e\u0432<\/li>\n<li>strToInt &#8212; \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f NumberFormatException<\/li>\n<li>main &#8212; \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0438\u0442\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0441\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u0433\u0434\u0435 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Scanner \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u0435\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c parseTextToTokens, \u044d\u0442\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/li>\n<\/ol>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Ideone: <a href=\"https:\/\/ideone.com\/BknxiN\" target=\"_blank\">https:\/\/ideone.com\/BknxiN<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0430 T, \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0449\u0443\u044e \u043a\u0430\u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0412\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043d\u0451\u043c \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0441\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=435\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,27,49,26],"tags":[44,46],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/435"}],"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\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435"}],"version-history":[{"count":11,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":586,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions\/586"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}