{"id":297449,"date":"2020-01-21T15:00:25","date_gmt":"2020-01-21T15:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297449"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297449","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#29: IT\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u2014 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442 \u0432\u0435\u0434\u0443\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/484276\/\">\u041f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0432\u044b \u043d\u0430 \u0423\u0420\u0410 \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u043b\u0438 \u0432 \u043d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u0438\u0435 \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u043a\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eb\/x8\/9c\/ebx89cutdtisffssraq3kmny39s.png\" alt=\"image\"><\/p>\n<p>  \u0410 \u043c\u044b \u0432\u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0440\u044f \u043d\u0435 \u0442\u0435\u0440\u044f\u043b\u0438 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0431\u043e\u0440\u043a\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u2014 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 VMWare. VMware \u2014 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f, \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0428\u0442\u0430\u0431-\u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u041f\u0430\u043b\u043e-\u0410\u043b\u044c\u0442\u043e, \u041a\u0430\u043b\u0438\u0444\u043e\u0440\u043d\u0438\u044f. \u041d\u0443 \u0447\u0442\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0430\u0448\u0438 \u0448\u0430\u043d\u0441\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u0443 \u043d\u0438\u0445 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f? <\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>! \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>1000 Coins and 10 Bags<\/b>  <\/p>\n<blockquote><p>A dealer has 1000 coins and 10 bags. He has to divide the coins over the ten bags, so that he can make any number of coins simply by handing over a few bags. How must divide his money into the ten bags?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0423 \u043f\u0440\u043e\u0434\u0430\u0432\u0446\u0430 1000 \u043c\u043e\u043d\u0435\u0442 \u0438 10 \u0441\u0443\u043c\u043e\u043a. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043c\u043e\u043d\u0435\u0442\u044b \u0432 \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0443\u043c\u043e\u043a \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043c\u043e\u0433 \u043d\u0430\u0431\u0440\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u043c\u043e\u043a. \u041a\u0430\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u043e\u043d\u0435\u0442\u044b \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0443\u043c\u043e\u043a?<\/div>\n<\/div>\n<p>  2. <b>Maximize probability of White Ball<\/b>  <\/p>\n<blockquote><p>There are two empty bowls in a room. You have 50 white balls and 50 black balls. After you place the balls in the bowls, a random ball will be picked from a random bowl. Distribute the balls (all of them) into the bowls to maximize the chance of picking a white ball.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043a\u043e\u043c\u043d\u0430\u0442\u0435 \u0434\u0432\u0435 \u043f\u0443\u0441\u0442\u044b\u0435 \u0447\u0430\u0448\u0438. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c 50 \u0431\u0435\u043b\u044b\u0445 \u0448\u0430\u0440\u043e\u0432 \u0438 50 \u0447\u0435\u0440\u043d\u044b\u0445 \u0448\u0430\u0440\u043e\u0432. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0448\u0430\u0440\u044b \u0432 \u0447\u0430\u0448\u0438, \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0447\u0430\u0448\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u043d \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0448\u0430\u0440. \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u0432\u0441\u0435 \u0448\u0430\u0440\u044b \u043f\u043e \u0447\u0430\u0448\u0430\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 \u0431\u0435\u043b\u043e\u0433\u043e \u0448\u0430\u0440\u0430.<\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Sieve of Eratosthenes<\/b>  <\/p>\n<blockquote><p>Given a number <b>N<\/b>, calculate the prime numbers upto <b>N<\/b> using Sieve of Eratosthenes. <\/p>\n<p>  <b>Input: <\/b><br \/>  The first line of the input contains <b>T<\/b> denoting the number of testcases. <b>T<\/b> testcases follow. Each testcase contains one line of input containing <b>N<\/b>.<\/p>\n<p>  <b>Output: <\/b><br \/>  For all testcases, in a new line, print all the prime numbers upto or equal to <b>N<\/b>.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= T&lt;= 100<br \/>  1 &lt;= N &lt;= 104<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  10<br \/>  35<\/code><br \/>  <b>Output:<\/b><br \/>  <code>2 3 5 7<br \/>  2 3 5 7 11 13 17 19 23 29 31 <\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d\u043e \u0447\u0438\u0441\u043b\u043e <b>N<\/b>, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0434\u043e <b>N<\/b>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0420\u0435\u0448\u0435\u0442\u043e \u042d\u0440\u0430\u0442\u043e\u0441\u0444\u0435\u043d\u0430.<\/p>\n<p>  <b>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <b>T<\/b>, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u0432\u043e\u0434\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e <b>N<\/b>.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0434\u043e \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u044b\u0435 <b>N<\/b>.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt;= T &lt;= 100<br \/>  1 &lt;= N &lt;= 104<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  <code>2<br \/>  10<br \/>  35<\/code><br \/>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>2 3 5 7<br \/>  2 3 5 7 11 13 17 19 23 29 31<\/code><\/div>\n<\/div>\n<p>  2. <b>Maximum Node Level<\/b>  <\/p>\n<blockquote><p>Find the level in a binary tree which has the maximum number of nodes. The root is at level 0.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line consists of <b>T<\/b> test cases. The first line of every test case consists of <b>N<\/b>, denoting the number of edges in the tree. The second and third line of every test case consists of <b>N<\/b>, nodes of the binary tree.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the level number with maximum nodes.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1&lt;=T&lt;=100<br \/>  1&lt;=N&lt;=100<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  3<br \/>  1 2 L 1 3 R 2 4 L<br \/>  3<br \/>  1 3 L 1 2 R 2 4 R<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>1<br \/>  1<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0437\u043b\u043e\u0432. \u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 0.<\/p>\n<p>  <b>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432 <b>T<\/b>. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 <b>N<\/b>, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0431\u0435\u0440 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435. \u0412\u0442\u043e\u0440\u0430\u044f \u0438 \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 <b>N<\/b> \u0443\u0437\u043b\u043e\u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u0443\u0440\u043e\u0432\u043d\u044f \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0437\u043b\u043e\u0432.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt;= \u0422 &lt;= 100<br \/>  1 &lt;= N &lt;= 100<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  <code>2<br \/>  3<br \/>  1 2 L 1 3 R 2 4 L<br \/>  3<br \/>  1 3 L 1 2 R 2 4 R<\/code><\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>1<br \/>  1<\/code><\/div>\n<\/div>\n<p>  3. <b>Kth smallest element<\/b>  <\/p>\n<blockquote><p>Given an array <b>arr[]<\/b> and a number <b>K<\/b> where <b>K<\/b> is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer <b>T<\/b>, denoting the number of testcases. Then <b>T<\/b> test cases follow. Each test case consists of three lines. First line of each testcase contains an integer <b>N<\/b> denoting size of the array. Second line contains <b>N<\/b> space separated integer denoting elements of the array. Third line of the test case contains an integer <b>K<\/b>.<\/p>\n<p>  <b>Output:<\/b><br \/>  Corresponding to each test case, print the kth smallest element in a new line.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= T &lt;= 100<br \/>  1 &lt;= N &lt;= 105<br \/>  1 &lt;= arr[i] &lt;= 105<br \/>  1 &lt;= K &lt;= N<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  6<br \/>  7 10 4 3 20 15<br \/>  3<br \/>  5<br \/>  7 10 4 20 15<br \/>  4<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>7<br \/>  15<\/code><\/p>\n<p>  <b>Explanation:<\/b><br \/>  <b>Testcase 1: <\/b>3rd smallest element in the given array is 7.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d \u043c\u0430\u0441\u0441\u0438\u0432 <b>arr[]<\/b> \u0438 \u0447\u0438\u0441\u043b\u043e <b>K<\/b>, \u0433\u0434\u0435 <b>K<\/b> \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 <b>K-\u0439<\/b> \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435. \u0412\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b.<\/p>\n<p>  <b>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <b>T<\/b>, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0442\u0435\u0441\u0442\u044b <b>T<\/b>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0441\u0442\u0440\u043e\u043a. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <b>N<\/b>, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <b>N<\/b> \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0422\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <b>K<\/b>.<\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  \u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 <b>k-\u0439<\/b> \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 &lt;= T &lt;= 100<br \/>  1 &lt;= N &lt;= 105<br \/>  1 &lt;= \u043e\u0431\u0440 [\u044f] &lt;= 105<br \/>  1 &lt;= K &lt;= N<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/b><br \/>  <code>2<br \/>  6<br \/>  7 10 4 3 20 15<br \/>  3<br \/>  5<br \/>  7 10 4 20 15<br \/>  4<\/code><\/p>\n<p>  <b>\u0412\u044b\u0445\u043e\u0434:<\/b><br \/>  <code>7<br \/>  15<\/code><\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435:<\/b><br \/>  <b>\u0422\u0435\u0441\u0442 1:<\/b> 3-\u0439 \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0440\u0430\u0432\u0435\u043d 7.<\/div>\n<\/div>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u0430\u043d\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u0443\u0441\u043f\u0435\u0439\u0442\u0435 \u0440\u0435\u0448\u0438\u0442\u044c. \u0423\u0434\u0430\u0447\u0438!<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/484276\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/484276\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/484276\/\">\u041f\u0440\u0438\u0432\u0435\u0442! \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0432\u044b \u043d\u0430 \u0423\u0420\u0410 \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u043b\u0438 \u0432 \u043d\u043e\u0432\u043e\u0433\u043e\u0434\u043d\u0438\u0435 \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u043a\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eb\/x8\/9c\/ebx89cutdtisffssraq3kmny39s.png\" alt=\"image\"><\/p>\n<p>  \u0410 \u043c\u044b \u0432\u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0440\u044f \u043d\u0435 \u0442\u0435\u0440\u044f\u043b\u0438 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0431\u043e\u0440\u043a\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u2014 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 VMWare. VMware \u2014 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f, \u043a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0428\u0442\u0430\u0431-\u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u041f\u0430\u043b\u043e-\u0410\u043b\u044c\u0442\u043e, \u041a\u0430\u043b\u0438\u0444\u043e\u0440\u043d\u0438\u044f. \u041d\u0443 \u0447\u0442\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0430\u0448\u0438 \u0448\u0430\u043d\u0441\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u0443 \u043d\u0438\u0445 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f? <\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/479320\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>! \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-297449","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=297449"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297449\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}