{"id":304337,"date":"2020-05-27T15:00:27","date_gmt":"2020-05-27T15:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=304337"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=304337","title":{"rendered":"\u0412\u044b\u043f\u0443\u0441\u043a#39: 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 post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/503314\/\">\u041f\u0440\u0438\u0432\u0435\u0442\u044b! \u0417\u0430\u043f\u0438\u043b\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0441 \u0437\u0430\u0434\u0430\u0447\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043f\u043b\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0437\u0433\u0430. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lv\/rf\/gf\/lvrfgfbbc-akz0h1aol2d9uigdm.png\"><\/p>\n<p>  \u0412\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0432 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0438\u0439 Walmart. \u041d\u0443 \u0447\u0442\u043e, \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0448\u0435\u0432\u0435\u043b\u0438\u0442\u044c \u0438\u0437\u0432\u0438\u043b\u0438\u043d\u0430\u043c\u0438? <\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/501126\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>. \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0412\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<p>  1. <b>Fill the Jug<\/b>  <\/p>\n<blockquote><p>There are two empty jugs each of 4 and 3 liters respectively, without any measuring marks. How many minimum steps are required to have 2 liters of water into the 4 litre jug (the jugs can be filled any number of times with water, and they can be emptied any number of times).<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043a\u0443\u0432\u0448\u0438\u043d\u0430 (\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0443\u0441\u0442\u044b\u0435) \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e 4 \u0438 3 \u043b\u0438\u0442\u0440\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043c\u0435\u0440\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0448\u0430\u0433\u043e\u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043b\u0438\u0442\u044c 2 \u043b\u0438\u0442\u0440\u0430 \u0432\u043e\u0434\u044b \u0432 4-\u0445 \u043b\u0438\u0442\u0440\u043e\u0432\u044b\u0439 \u043a\u0443\u0432\u0448\u0438\u043d (\u043a\u0443\u0432\u0448\u0438\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u043e\u0434\u043e\u0439 \u0438 \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437).<\/div>\n<\/p><\/div>\n<p>  2. <b>Geek and Cashier<\/b>  <\/p>\n<blockquote><p>A Geek asks a cashier to pay Rs 200 for a cool program written by him. He asks the cashier to pay only in the following way:  <\/p>\n<ul>\n<li>Few 1 Rs Notes. Let x.<\/li>\n<li>Few 2 Rs Notes. Must ten times of 1 Rs Notes, i.e., 10x.<\/li>\n<li>Rest of the money as 5 Rs Notes(Minimum number Rs 5 notes should be used)<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pm\/e1\/7b\/pme17b1j7hr39-7ejxviojpgv7u.png\"><\/p>\n<p>  How does the Geek\u2019s Cashier plan to pay?<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0413\u0438\u043a \u043f\u0440\u043e\u0441\u0438\u0442 \u043a\u0430\u0441\u0441\u0438\u0440\u0430 \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c 200 \u0440\u0443\u043f\u0438\u0439 \u0437\u0430 \u043a\u043b\u0430\u0441\u0441\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0438\u043c \u0441\u0430\u043c\u0438\u043c. \u041e\u043d \u043f\u0440\u043e\u0441\u0438\u0442 \u043a\u0430\u0441\u0441\u0438\u0440\u0430 \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ul>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u043d\u043a\u043d\u043e\u0442 \u043f\u043e 1 \u0420\u0443\u043f\u0438\u0438. \u041f\u0443\u0441\u0442\u044c X.<\/li>\n<li>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u043d\u043a\u043d\u043e\u0442 \u043f\u043e 2 \u0420\u0443\u043f\u0438\u0438. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u0434\u0435\u0441\u044f\u0442\u044c \u0440\u0430\u0437 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0431\u0430\u043d\u043a\u043d\u043e\u0442 \u043f\u043e 1 \u0440\u0443\u043f\u0438\u0438, \u0442\u043e \u0435\u0441\u0442\u044c 10\u0445.<\/li>\n<li>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u043d\u044c\u0433\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0430\u043d\u043a\u043d\u043e\u0442 \u043f\u043e 5 \u0440\u0443\u043f\u0438\u0439(\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u043d\u043a\u043d\u043e\u0442 \u043f\u043e 5 \u0440\u0443\u043f\u0438\u0439 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e)<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pm\/e1\/7b\/pme17b1j7hr39-7ejxviojpgv7u.png\"><br \/>  \u041a\u0430\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u043b\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0441\u0441\u0438\u0440?<\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  1. <b>Reverse words in a given string<\/b>  <\/p>\n<blockquote><p>Given a String of length <b>S<\/b>, reverse the whole string without reversing the individual words in it. Words are separated by <b>dots<\/b>.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line contains <b>T<\/b> denoting the number of testcases. T testcases follow. Each case contains a string S containing characters.<\/p>\n<p>  <b>Output:<\/b><br \/>  For each test case, in a new line, output a single line containing the reversed String.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 &lt;= T &lt;= 100<br \/>  1 &lt;= |S| &lt;= 2000<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  i.like.this.program.very.much<br \/>  pqr.mno<\/code><\/p>\n<p>  <b>Output:<\/b><br \/>  <code>much.very.program.this.like.i<br \/>  mno.pqr<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 S. \u041f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u0432\u0441\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0432 \u043d\u0435\u0439. \u0421\u043b\u043e\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u0442\u043e\u0447\u043a\u0430\u043c\u0438.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\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\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 S, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u044b.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043f\u0435\u0440\u0435\u0432\u0435\u0440\u043d\u0443\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/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;= |S| &lt;= 2000<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  i.like.this.program.very.much<br \/>  pqr.mno<\/code><\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>much.very.program.this.like.i<br \/>  mno.pqr<\/code><\/div>\n<\/p><\/div>\n<p>  2. <b>Kadane&#8217;s Algorithm<\/b>  <\/p>\n<blockquote><p>Given an array arr of N integers. Find the contiguous sub-array with maximum sum.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single integer N denoting the size of array. The second line contains N space-separated integers A1, A2, &#8230;, AN denoting the elements of the array.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the maximum sum of the contiguous sub-array in a separate line for each test case.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 110<br \/>  1 \u2264 N \u2264 106<br \/>  -107 \u2264 A[i] &lt;= 107<\/code><\/p>\n<p>  <b>Example:<br \/>  Input<\/b><br \/>  <code>2<br \/>  5<br \/>  1 2 3 -2 5<br \/>  4<br \/>  -1 -2 -3 -4<\/code><br \/>  <b>Output<\/b><br \/>  <code>9<br \/>  -1<\/code><\/p>\n<p>  <b>Explanation:<\/b><br \/>  <b>Testcase 1:<\/b> Max subarray sum is 9 of elements (1, 2, 3, -2, 5) which is a contiguous subarray.<\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <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\u0437 <b>N <\/b>\u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0441\u043c\u0435\u0436\u043d\u044b\u0439 \u0441\u0443\u0431-\u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u043e\u0439.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e T, \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. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 t \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e N, \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 N \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 A1, A2,&#8230;, \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u0441\u043c\u0435\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 \u2264 T \u2264 110<br \/>  1 \u2264 N \u2264 106<br \/>  -107 \u2264 A[i] &lt;= 107<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434<\/b><br \/>  <code>2<br \/>  5<br \/>  1 2 3 -2 5<br \/>  4<br \/>  -1 -2 -3 -4<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434<\/b><br \/>  <code>9<br \/>  -1<\/code><\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435:<\/b><br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0440 1:<\/b> \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432 \u2014 \u0441\u0443\u043c\u043c\u0430 9 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (1, 2, 3, -2, 5) \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u043c\u0430\u0441\u0441\u0438\u0432.<\/div>\n<\/p><\/div>\n<p>  3. <b>Ugly Numbers<\/b>  <\/p>\n<blockquote><p>Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, \u2026 shows the first 11 ugly numbers. By convention, 1 is included. Write a program to find Nth Ugly Number.<\/p>\n<p>  <b>Input:<\/b><br \/>  The first line of input contains an integer T denoting the number of test cases. T testcases follow. For each testcase there is one line of input that contains the number N.<\/p>\n<p>  <b>Output:<\/b><br \/>  Print the Nth Ugly Number.<\/p>\n<p>  <b>Constraints:<\/b><br \/>  <code>1 \u2264 T \u2264 104<br \/>  1 \u2264 N \u2264 104<\/code><\/p>\n<p>  <b>Example:<br \/>  Input:<\/b><br \/>  <code>2<br \/>  10<br \/>  4<\/code><br \/>  <b>Output:<\/b><br \/>  <code>12<br \/>  4<\/code><\/p><\/blockquote>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0432\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0423\u0440\u043e\u0434\u043b\u0438\u0432\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f 2, 3 \u0438\u043b\u0438 5. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15,\u2026 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 11 \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041f\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e, \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430. \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 N-\u0435 \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<\/p>\n<p>  <b>\u0412\u0432\u043e\u0434:<\/b><br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e T, \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. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0432\u043e\u0434\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0447\u0438\u0441\u043b\u043e N.<\/p>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  \u0412\u044b\u0432\u0435\u0441\u0442\u0438 N-\u043d\u043d\u043e\u0435 \u043f\u043e \u0441\u0447\u0451\u0442\u0443 \u00ab\u0443\u0440\u043e\u0434\u043b\u0438\u0432\u043e\u0435\u00bb \u0447\u0438\u0441\u043b\u043e. <\/p>\n<p>  <b>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/b><br \/>  <code>1 \u2264 T \u2264 104<br \/>  1 \u2264 N \u2264 104<\/code><\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0440:<br \/>  \u0412\u0432\u043e\u0434:<\/b><br \/>  <code>2<br \/>  10<br \/>  4<\/code><br \/>  <b>\u0412\u044b\u0432\u043e\u0434:<\/b><br \/>  <code>12<br \/>  4<\/code><\/div>\n<\/p><\/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\/503314\/\"> https:\/\/habr.com\/ru\/company\/spice\/blog\/503314\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/503314\/\">\u041f\u0440\u0438\u0432\u0435\u0442\u044b! \u0417\u0430\u043f\u0438\u043b\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0441 \u0437\u0430\u0434\u0430\u0447\u043a\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043f\u043b\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0437\u0433\u0430. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lv\/rf\/gf\/lvrfgfbbc-akz0h1aol2d9uigdm.png\"><\/p>\n<p>  \u0412\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0432 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0438\u0439 Walmart. \u041d\u0443 \u0447\u0442\u043e, \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0448\u0435\u0432\u0435\u043b\u0438\u0442\u044c \u0438\u0437\u0432\u0438\u043b\u0438\u043d\u0430\u043c\u0438? <\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0443\u0436\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/spice\/blog\/501126\/\">\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b<\/a>. \u0421\u0432\u0435\u0440\u044f\u0439\u0442\u0435\u0441\u044c.<\/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-304337","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304337","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=304337"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304337\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}