{"id":331881,"date":"2022-04-13T15:00:27","date_gmt":"2022-04-13T15:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=331881"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=331881","title":{"rendered":"<span>\u041c\u0430\u0441\u043a\u0438, \u043a\u0430\u0440\u0442\u0438\u043d\u044b, \u0442\u0430\u0439\u043d\u044b\u0435 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u0438 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0434\u0430\u0436: \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f Go-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">3 \u0430\u043f\u0440\u0435\u043b\u044f \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 All Cups \u043f\u0440\u043e\u0448\u043b\u043e \u043e\u0442\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0443\u0440\u0441 \u00ab<a href=\"https:\/\/route256.ozon.ru\/go-developer\">\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Go<\/a>\u00bb \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u043a\u0443\u0440\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 Ozon Tech. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043c\u0438\u0434\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0435\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434\u0438\u0441\u0442\u044b All Cups \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043e\u043a: \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044b \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/91d\/218\/328\/91d2183285225edaa9b93ab1fac8dd75.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/91d\/218\/328\/91d2183285225edaa9b93ab1fac8dd75.png\"\/><\/div>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u041c\u0430\u0441\u043a\u0438\u00bb<\/h2>\n<p>  \u041d\u0438\u043a\u0438\u0442\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u0432\u044b\u0434\u0430\u0447\u0438 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 (\u041f\u0412\u0417). \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u041d\u0438\u043a\u0438\u0442\u0430 \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u041f\u0412\u0417 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u0441\u043a\u0438\u043c\u0438 \u043c\u0430\u0441\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0448\u0442\u0443\u043a. \u041c\u0435\u0441\u0442\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0438 \u043f\u0440\u043e\u0434\u0430\u044e\u0442 \u043c\u0430\u0441\u043a\u0438 \u043f\u043e \u0446\u0435\u043d\u0435 0,55 \u0440\u0443\u0431\u043b\u0435\u0439 \u0437\u0430 \u043e\u0434\u043d\u0443 \u0448\u0442\u0443\u043a\u0443, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c, \u043a\u0443\u043f\u0438\u0432 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443 \u0438\u0437 24 \u043c\u0430\u0441\u043e\u043a \u0437\u0430 11 \u0440\u0443\u0431\u043b\u0435\u0439 \u0438\u043b\u0438 \u043a\u043e\u0440\u043e\u0431\u043a\u0443 \u0438\u0437 16 \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a \u0437\u0430 160 \u0440\u0443\u0431\u043b\u0435\u0439. \u041f\u043e\u043c\u043e\u0433\u0438\u0442\u0435 \u041d\u0438\u043a\u0438\u0442\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043e\u0431\u043e\u043a, \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0441\u043e\u043a \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043a\u0443\u043f\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0435\u043d\u0435\u0433.<\/p>\n<p>  <strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u041d\u0438\u043a\u0438\u0442\u0430 \u0433\u043e\u0442\u043e\u0432 \u043a\u0443\u043f\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0430\u0441\u043e\u043a, \u0447\u0435\u043c \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8c6\/7e1\/06c\/8c67e106c42f26e64c9cfaa98b9351a1.svg\" alt=\"$N (1 \u2264 N \u2264 50000)$\" data-tex=\"inline\"\/>.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0440\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0441\u043e\u043a, \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a \u0438 \u043a\u043e\u0440\u043e\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u043a\u0443\u043f\u0438\u0442\u044c.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043a\u0443\u043f\u0438\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9cb\/9dc\/bb4\/9cb9dcbb4c7913e04a7b7fb86daf2639.svg\" alt=\"$16 \\times 24 = 384$\" data-tex=\"inline\"\/> \u043c\u0430\u0441\u043a\u0438, \u0442\u043e \u0432\u044b\u0433\u043e\u0434\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043a\u043e\u0440\u043e\u0431\u043a\u0443. \u0410 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7a7\/421\/bcb\/7a7421bcbc55846c08ce0554cc6129f6.svg\" alt=\"$24$\" data-tex=\"inline\"\/> \u043c\u0430\u0441\u043a\u0438, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043a\u0443\u043f\u0438\u0442\u044c \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443, \u0430 \u043d\u0435 \u043f\u043e\u0448\u0442\u0443\u0447\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438: <\/p>\n<ol>\n<li>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0443\u043f\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0440\u043e\u0431\u043e\u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ab5\/a22\/a36\/ab5a22a36472ef3e3d426d6cc2ccec3c.svg\" alt=\"$K = \\lfloor \\frac{N}{384} \\rfloor$\" data-tex=\"inline\"\/>. <\/li>\n<li>\u0417\u0430\u0442\u0435\u043c \u2014 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/38c\/aa0\/3cf\/38caa03cfe7be4307a738f3d6619f3a1.svg\" alt=\"$M = \\lfloor \\frac{N \u2014 384K}{24} \\rfloor$\" data-tex=\"inline\"\/>. <\/li>\n<li>\u0418 \u043e\u0441\u0442\u0430\u0442\u043e\u043a M \u0434\u043e\u043a\u0443\u043f\u0438\u0442\u044c \u043f\u043e\u0448\u0442\u0443\u0447\u043d\u043e.<\/li>\n<\/ol>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0433\u043e\u0434\u043d\u044b\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u0443\u043f\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u043c\u0430\u0441\u043a\u0438, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0440\u043e\u0431\u043e\u043a \u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0433\u043e\u0434\u043d\u0435\u0435 \u043a\u0443\u043f\u0438\u0442\u044c \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443, \u0447\u0435\u043c \u0434\u043e\u043a\u0443\u043f\u0430\u0442\u044c \u043f\u043e\u0448\u0442\u0443\u0447\u043d\u043e: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/da0\/f2a\/aa3\/da0f2aaa384a885f2124b501833112a9.svg\" alt=\"$M \\times 0,55 > 11$&#187; data-tex=&#187;inline&#187;\/>. \u0410 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0433\u043e\u0434\u043d\u043e \u043a\u0443\u043f\u0438\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043a\u043e\u0440\u043e\u0431\u043a\u0443? \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0ac\/7ae\/76e\/0ac7ae76ec995ade1526ee43e5479d20.svg\" alt=\"$M' \\times 0,55 + K' \\times 11 > 160$&#187; data-tex=&#187;inline&#187;\/>, \u0433\u0434\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0a0\/c0e\/bf2\/0a0c0ebf25e68a6557d093aa3670b7d9.svg\" alt=\"$M'$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/753\/1b5\/c9a\/7531b5c9a4e95e581be34b2bb9481594.svg\" alt=\"$K'$\" data-tex=\"inline\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0430\u0441\u043e\u043a \u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u043e\u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u044b\u0435 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432 \u043a\u043e\u0434\u0435.  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u0421\u043a\u043b\u0430\u0434\u044b\u00bb<\/h2>\n<p>  \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f-\u0437\u0430\u0441\u0442\u0440\u043e\u0439\u0449\u0438\u043a \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043a\u043b\u0430\u0434\u0441\u043a\u0438\u0445 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0439. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u0440 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0441\u0442\u043e\u0438\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffe\/7fb\/ad9\/ffe7fbad9e8131a5d99bf8feffe52f62.svg\" alt=\"$L$\" data-tex=\"inline\"\/> \u0440\u0443\u0431\u043b\u0435\u0439. \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0430\u0441 \u043e\u0431\u043e\u0440\u043e\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430, \u0430 \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0435\u0439 \u044d\u0442\u043e \u0432\u044b\u0433\u043e\u0434\u043d\u043e. \u0420\u044b\u043d\u043e\u043a \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0446\u0435\u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0440\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0437\u0430\u0441\u0442\u0440\u043e\u0439\u0449\u0438\u043a\u0430 \u0441\u043c\u043e\u0433\u043b\u0438 \u0442\u043e\u0447\u043d\u043e \u0441\u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0446\u0435\u043d\u0443 \u043d\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0434\u043d\u0435\u0439 (\u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u0443\u0435\u043c \u0434\u043d\u0438 \u0432 \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/> \u0434\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a14\/5bb\/1cf\/a145bb1cfe8328b8a4b2961c6a9093f1.svg\" alt=\"$N-1$\" data-tex=\"inline\"\/>). \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0432 \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u043d\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0430\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0434\u043d\u0435\u0439 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u043d\u0435\u0433. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u043e\u0432\u044b\u0445 \u043f\u043b\u043e\u0449\u0430\u0434\u0435\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b23\/a99\/a6f\/b23a99a6f174ca2c08127e778e52a990.svg\" alt=\"$S$\" data-tex=\"inline\"\/> \u043a\u0432. \u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0441\u0443\u0442\u043a\u0438. \u0410 \u043a \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0434\u043d\u044e \u043e\u0431\u044a\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b23\/a99\/a6f\/b23a99a6f174ca2c08127e778e52a990.svg\" alt=\"$S$\" data-tex=\"inline\"\/> \u043a\u0432. \u043c\u0435\u0442\u0440\u043e\u0432, \u043f\u0440\u0438 \u0442\u043e\u043c \u0447\u0442\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/138\/daf\/6bb\/138daf6bb48e9b00400bc16364660667.svg\" alt=\"$S = 1$\" data-tex=\"inline\"\/>.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/400\/f67\/3c3\/400f673c3c7c521bf0404ea593c84b3a.svg\" alt=\"$N (0 &lt; N &lt; 10000)$\" data-tex=\"inline\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043d\u0435\u0439. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0446\u0435\u043b\u044b\u0445 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u2014 \u0446\u0435\u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0440\u0430 \u0441\u043a\u043b\u0430\u0434\u0441\u043a\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0434\u043d\u0435\u0439.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u043d\u0435\u0433, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f-\u0437\u0430\u0441\u0442\u0440\u043e\u0439\u0449\u0438\u043a.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u00ab\u0436\u0430\u0434\u043d\u044b\u0439\u00bb \u043f\u043e\u0434\u0445\u043e\u0434: \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u0440 \u0437\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0446\u0435\u043d\u0443. \u041f\u0443\u0441\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/618\/3e8\/1b9\/6183e81b954bf0525f5ff4228c439f02.svg\" alt=\"$L_i$\" data-tex=\"inline\"\/> \u2014 \u0446\u0435\u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0440\u0430 \u0441\u043a\u043b\u0430\u0434\u043e\u0432 \u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b87\/c43\/419\/b87c4341953d9930499c99cfd4f7de89.svg\" alt=\"$i$\" data-tex=\"inline\"\/>-\u0439 \u0434\u0435\u043d\u044c. \u041a\u0430\u043a\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0440\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u043a <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b87\/c43\/419\/b87c4341953d9930499c99cfd4f7de89.svg\" alt=\"$i$\" data-tex=\"inline\"\/>-\u043c\u0443 \u0434\u043d\u044e? \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432 \u043b\u044e\u0431\u043e\u0439 \u0434\u0435\u043d\u044c \u0441 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b87\/c43\/419\/b87c4341953d9930499c99cfd4f7de89.svg\" alt=\"$i$\" data-tex=\"inline\"\/>-\u0433\u043e \u043f\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c68\/8fe\/869\/c688fe869899ad6ad070299733f727c3.svg\" alt=\"$(N \u2014 1)$\" data-tex=\"inline\"\/>-\u0439, \u0442\u043e \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0435\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/929\/c6d\/567\/929c6d567940397a9ccf94a7e292cb87.svg\" alt=\"$\\max(L_i, L_{i+1} \\dots L_{N-1})$\" data-tex=\"inline\"\/>. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043d\u044f. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0437\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0432 \u0434\u0435\u043d\u044c \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043d\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0439\u043a\u0438. <\/p>\n<p>  \u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u043e\u0435, \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0437\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f! \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0439\u0434\u0451\u043c \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffe\/7fb\/ad9\/ffe7fbad9e8131a5d99bf8feffe52f62.svg\" alt=\"$L$\" data-tex=\"inline\"\/> \u0441 \u043a\u043e\u043d\u0446\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0435\u0434\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043e\u043c\u0430\u044f \u0446\u0435\u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u0436\u0438!  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u041a\u0430\u0440\u0442\u0438\u043d\u044b\u00bb <\/h2>\n<p>  \u041c\u0430\u043a\u0441\u0438\u043c \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0434\u0430\u0436\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d \u043d\u0430 NFT-\u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430\u0445, \u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0435 \u0438 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435. \u041c\u0430\u043a\u0441\u0438\u043c\u0443 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0446\u0438\u0444\u0440\u044b \u043d\u0430 \u0447\u0435\u0440\u043d\u043e\u043c \u0444\u043e\u043d\u0435. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0435.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0447\u0438\u0441\u0435\u043b \u0438\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u00ab\u041a\u0432\u0430\u0434\u0440\u0430\u0442 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 N\u00bb. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0447\u0438\u0441\u0435\u043b \u0438\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u2014 \u0434\u043b\u0438\u043d\u0430 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u0443 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0435\u0451 \u043d\u0443\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Bash. \u0417\u0430\u0434\u0430\u0447\u0430 \u0447\u0438\u0441\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0432\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0437\u043d\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443: <br \/> \n<pre><code class=\"bash\">read line array=($line) len=${#array[@]} <\/code><\/pre>\n<\/li>\n<li>\u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0444\u0440\u0430\u0437\u0443 \u043f\u0440\u043e \u00ab\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u00bb:<br \/> \n<pre><code class=\"bash\">echo \"\u041a\u0432\u0430\u0434\u0440\u0430\u0442 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 $len\" <\/code><\/pre>\n<\/li>\n<li>\u0418 \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0446\u0438\u043a\u043b\u043e\u043c \u0441\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u043e\u043c \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6b6\/38a\/b28\/6b638ab28f7137339c5cda9793e499fb.svg\" alt=\"$len$\" data-tex=\"inline\"\/> \u0440\u0430\u0437:<br \/> \n<pre><code class=\"bash\">for (( i = 0; i &lt; $len; i++ )) do     echo $line done <\/code><\/pre>\n<\/li>\n<\/ol>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u041f\u0440\u043e\u0434\u0430\u0436\u0438\u00bb<\/h2>\n<p>  \u0412 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 <code>Invoice<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/3ea\/00a\/ceb\/3ea00aceb0c43e7409f0a94ffd01cf16.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3ea\/00a\/ceb\/3ea00aceb0c43e7409f0a94ffd01cf16.png\"\/><\/div>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0430\u043c, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u044b, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0431\u0449\u0438\u0445 \u043f\u0440\u043e\u0434\u0430\u0436.<\/p>\n<p>  <i>\u041d\u0430 \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442\u0435 \u0432\u043e \u0444\u0440\u0430\u0437\u0435 \u00ab\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435\u00bb \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0441\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0430\u043c. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430.<\/i><\/p>\n<p>  <strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Chinook Database \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SQLite \u2014 \u0441\u043c. \u0444\u0430\u0439\u043b <a href=\"https:\/\/cups.online\/api_v2\/task\/1225\/124\">Chinook_Sqlite.sqlite<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445. \u041f\u0435\u0440\u0432\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>GROUP BY<\/code>, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>ORDER BY<\/code>. \u0422\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043e\u0431\u0449\u0438\u0435 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0430\u043c, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f, \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"sql\">SELECT     BillingCountry,     SUM(total) FROM     Invoice GROUP BY BillingCountry ORDER BY SUM(total); <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>SUM<\/code> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 <code>GROUP BY<\/code> \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u2014 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0434\u0430\u0436 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u044b.  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u0422\u0430\u0439\u043d\u044b\u0435 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u0438\u00bb<\/h2>\n<p>  \u041f\u0430\u0448\u0430 \u0438 \u0421\u0430\u0448\u0430 \u043f\u0440\u043e\u0436\u0438\u0432\u0430\u044e\u0442 \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043f\u043e\u0434\u043c\u043e\u0441\u043a\u043e\u0432\u043d\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0440\u0430\u0439\u043e\u043d\u043e\u0432. \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0434\u0432\u0430 \u0434\u0440\u0443\u0433\u0430 \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u044c \u0442\u0430\u0439\u043d\u044b\u043c\u0438 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0432 Ozon. \u041e\u043d\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u043a \u0434\u0435\u043b\u0443 \u043e\u0447\u0435\u043d\u044c \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u044f\u0442 \u043e\u0431\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u0432\u044b\u0434\u0430\u0447\u0438, \u043f\u043e\u0441\u043e\u0432\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0439\u043e\u043d\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0442\u043e\u0447\u043a\u0430 \u0432\u044b\u0434\u0430\u0447\u0438. \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0432 \u043a\u0430\u0440\u0442\u0443 \u0433\u043e\u0440\u043e\u0434\u0430, \u0440\u0435\u0431\u044f\u0442\u0430 \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u0443 \u043d\u0438\u0445 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0443\u0436 \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u0438\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0445\u043e\u0434\u0438\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0439, \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u0445\u043e\u0434\u0430, \u0432\u0437\u044f\u0442\u043e\u043c\u0443 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c6b\/38e\/9e5\/c6b38e9e57593c513299660fe8151d5f.svg\" alt=\"$T$\" data-tex=\"inline\"\/>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u0437\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/235\/dbb\/d23\/235dbbd235292bd972735b4fd4224b7f.svg\" alt=\"$M$\" data-tex=\"inline\"\/> \u0434\u0440\u0443\u0437\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u0434\u0440\u0443\u0437\u0435\u0439 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0440\u0430\u0437\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0432\u044b\u0434\u0430\u0447\u0438: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cf3\/435\/7ee\/cf34357ee1a7d04fe64d33e661bbde61.svg\" alt=\"$N_{1}$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/00a\/45a\/46c\/00a45a46c3d619a1b76e61575f79242a.svg\" alt=\"$N_{2}$\" data-tex=\"inline\"\/>, &#8230;, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0a4\/85a\/003\/0a485a0036f2600e2f690bd977611480.svg\" alt=\"$N_{m}$\" data-tex=\"inline\"\/>. \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u0445\u043e\u0434\u043e\u0432 \u0432\u0441\u0435\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u0432\u044b\u0434\u0430\u0447\u0438 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/b>: \u041f\u0430\u0448\u0430 \u0438 \u0421\u0430\u0448\u0430 \u0445\u043e\u0434\u044f\u0442 \u0432\u043c\u0435\u0441\u0442\u0435, \u0430 \u0434\u0440\u0443\u0437\u044c\u044f \u043f\u043e\u043e\u0434\u0438\u043d\u043e\u0447\u043a\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/563\/7fd\/ad8\/5637fdad8a4b55db3153c362532892c6.svg\" alt=\"$N=3$\" data-tex=\"inline\"\/> \u0435\u0441\u0442\u044c 6 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0431\u0445\u043e\u0434\u043e\u0432 (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2d5\/820\/f3d\/2d5820f3db227f9d21cc9fce7e098f03.svg\" alt=\"$abc$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/585\/b40\/720\/585b40720b43f4c89a4e5ddef05e4e92.svg\" alt=\"$acb$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/521\/c6b\/2a6\/521c6b2a62a22c5f41ec8b6ee131f921.svg\" alt=\"$bac$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8d0\/f0a\/491\/8d0f0a4911d868ab7773ffe0b322546e.svg\" alt=\"$bca$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1fd\/f99\/e6c\/1fdf99e6cd93c861a7b4ff603d7bde14.svg\" alt=\"$cba$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/70e\/46c\/d7a\/70e46cd7a04d8c049321527479c78781.svg\" alt=\"$cab$\" data-tex=\"inline\"\/>), \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 6 \u044d\u0442\u043e 0. \u0410 \u0434\u043b\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/795\/fcb\/da9\/795fcbda9b363cd39c035c5e5bf0e636.svg\" alt=\"$N=4$\" data-tex=\"inline\"\/> \u2014 24 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0431\u0445\u043e\u0434\u043e\u0432 (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/89a\/aff\/d00\/89aaffd0030cd2710d85eea796590f80.svg\" alt=\"$abcd$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/402\/cf4\/6a7\/402cf46a756f41e4dde030c311cc2837.svg\" alt=\"$abdc$\" data-tex=\"inline\"\/>,\u2026, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f8f\/193\/e3f\/f8f193e3f9c3a123bc7d5f6a3f1fa51b.svg\" alt=\"$dcba$\" data-tex=\"inline\"\/>). 24 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e 7 \u0431\u0443\u0434\u0435\u0442 3.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/64e\/9d1\/90b\/64e9d190bda4b7d3938117fd8f271d10.svg\" alt=\"$\u041c (1 \u2264 \u041c &lt; 1000)$\" data-tex=\"inline\"\/>. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ea8\/476\/acc\/ea8476acc1a486af699bc71872f757fc.svg\" alt=\"$M+1$\" data-tex=\"inline\"\/> \u0441\u0442\u0440\u043e\u043a, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c6b\/38e\/9e5\/c6b38e9e57593c513299660fe8151d5f.svg\" alt=\"$T$\" data-tex=\"inline\"\/> (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/18f\/bac\/66a\/18fbac66a8a8cd0ad8225f67dc83a962.svg\" alt=\"$1 \u2264 n \u2264 10^{18}$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0a7\/e9d\/418\/0a7e9d4189c6aaf6e8be559df9f38c89.svg\" alt=\"$1 \u2264 T \u2264 10 000 000$\" data-tex=\"inline\"\/>).<\/p>\n<blockquote><p>\u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0433\u043b\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9aa\/e08\/704\/9aae087046a60218262bab4a00522adc.svg\" alt=\"$N$\" data-tex=\"inline\"\/>. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.<\/p><\/blockquote>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412\u044b\u0432\u0435\u0441\u0442\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/099\/88c\/8b4\/09988c8b4eda4e470afc6f7eeab86b92.svg\" alt=\"$\u041c+1$\" data-tex=\"inline\"\/> \u0447\u0438\u0441\u0435\u043b \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0445\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2af\/1fd\/565\/2af1fd565aecbce940de79477fd0a784.svg\" alt=\"$m+1$\" data-tex=\"inline\"\/> \u043f\u0430\u0440 \u0447\u0438\u0441\u0435\u043b <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3f3\/a06\/28e\/3f3a0628efca3886390458e5d61fabdf.svg\" alt=\"$n_i$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/781\/c12\/98d\/781c1298d3c85158d34a5dd5a9e2b375.svg\" alt=\"$t_i$\" data-tex=\"inline\"\/> \u043d\u0430\u0439\u0442\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3f3\/a06\/28e\/3f3a0628efca3886390458e5d61fabdf.svg\" alt=\"$n_i$\" data-tex=\"inline\"\/> \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/781\/c12\/98d\/781c1298d3c85158d34a5dd5a9e2b375.svg\" alt=\"$t_i$\" data-tex=\"inline\"\/>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3f3\/a06\/28e\/3f3a0628efca3886390458e5d61fabdf.svg\" alt=\"$n_i$\" data-tex=\"inline\"\/> \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0435\u043b\u0438\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b \u0437\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>  \u0417\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u043a\u0442: \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/335\/869\/ac7\/335869ac719149008bcae54aa61bb94a.svg\" alt=\"$a \u2264 b$\" data-tex=\"inline\"\/> \u043a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/451\/ae8\/3b5\/451ae83b5047937cbb3c02f2b2f16bec.svg\" alt=\"$b!$\" data-tex=\"inline\"\/> \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0431\u0435\u0437 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8f4\/5ac\/495\/8f45ac4953a8010207f0f92306982b3b.svg\" alt=\"$a$\" data-tex=\"inline\"\/>. \u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0434\u0432\u0430 \u0441\u043b\u0443\u0447\u0430\u044f:<\/p>\n<ol>\n<li><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9da\/87c\/0ac\/9da87c0acb21fd0e10c2075e1dedc1d3.svg\" alt=\"$n_i \\ge t_i$\" data-tex=\"inline\"\/>: \u043e\u0442\u0432\u0435\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/>.<\/li>\n<li><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cf1\/31a\/32b\/cf131a32bdf4c2f9ac0b9b51575c4b35.svg\" alt=\"$n_i &lt; t_i$\" data-tex=\"inline\"\/>: \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0437\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043d\u0430\u043c \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/781\/c12\/98d\/781c1298d3c85158d34a5dd5a9e2b375.svg\" alt=\"$t_i$\" data-tex=\"inline\"\/>).<\/li>\n<\/ol>\n<p>  \u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u043c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e, \u0442\u043e \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0430 \u0435\u0433\u043e \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430:<\/p>\n<pre><code class=\"go\">fact = 1 for i from 2 to n     fact = (fact * i) mod t <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b\u00bb<\/h2>\n<p>  \u041a\u0438\u0440\u0438\u043b\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u043c \u0432 Ozon, \u0438 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0435\u043c\u0443 \u0432 \u0440\u0443\u043a\u0438 \u043f\u043e\u043f\u0430\u043b \u043e\u0442\u0447\u0451\u0442, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u043f\u0443\u043d\u043a\u0442\u044b \u0432\u044b\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c. \u041e\u043d \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043f\u0443\u043d\u043a\u0442\u044b \u0432\u044b\u0434\u0430\u0447\u0438 \u0432 \u0433\u043e\u0440\u043e\u0434\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u0435\u0440\u0448\u0438\u043d, \u0440\u0430\u0432\u043d\u044b\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/35b\/a56\/5f3\/35ba565f36734f3a55aa01ac67868762.svg\" alt=\"$n$\" data-tex=\"inline\"\/>, \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0435\u0433\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u0445, \u0433\u0434\u0435 \u043e\u0434\u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 = \u043e\u0434\u0438\u043d \u043f\u0443\u043d\u043a\u0442 \u0432\u044b\u0434\u0430\u0447\u0438. \u041a\u0438\u0440\u0438\u043b\u043b \u0440\u0435\u0448\u0438\u043b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u043c\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043e\u043d \u0445\u043e\u0447\u0435\u0442 \u043f\u0440\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u043e\u0437\u0434\u0443\u0448\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0447\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043a\u0443\u0440\u044c\u0435\u0440\u044b \u043d\u0430 \u0433\u0440\u0443\u0437\u043e\u043f\u043e\u0434\u044a\u0451\u043c\u043d\u044b\u0445 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0430\u043d\u0446\u0430\u0445.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u0432\u044b\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d \u0441 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/> \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0447\u0438 \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/>, \u0447\u0442\u043e\u0431\u044b \u043a\u0440\u0430\u0442\u0447\u0430\u0439\u0448\u0435\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0447\u0438 \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b88\/ce3\/99f\/b88ce399fda6c8123ab168cb507210f2.svg\" alt=\"$r$\" data-tex=\"inline\"\/>. \u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432\u044b\u0434\u0430\u0447\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0432\u044b\u0434\u0430\u0447\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/586\/484\/b20\/586484b20f727888bca22dc32c81c1d9.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/586\/484\/b20\/586484b20f727888bca22dc32c81c1d9.png\"\/><\/div>\n<p>  <strong>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443<\/strong>  <\/p>\n<ol>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5ef\/4a0\/ca9\/5ef4a0ca952e090ce3438f31407bafc4.svg\" alt=\"$n = 6$\" data-tex=\"inline\"\/> \u0432\u044b\u0431\u0440\u0430\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/738\/f4e\/57e\/738f4e57e0acafbb8c08262daa540b90.svg\" alt=\"$k = 1$\" data-tex=\"inline\"\/> (\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u0434\u043d\u0438\u043c \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u043c \u0441\u043e\u0441\u0435\u0434\u043e\u043c \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430), \u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442 \u0443\u0437\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f6b\/9aa\/2bb\/f6b9aa2bb612b936cf731b846ed495d6.svg\" alt=\"$A$\" data-tex=\"inline\"\/> \u0434\u043e \u0443\u0437\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2e2\/3b0\/ca7\/2e23b0ca7b48e0096c7d8eb2d3c3d0ca.svg\" alt=\"$D$\" data-tex=\"inline\"\/> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e 3. \u041d\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7d6\/494\/4aa\/7d64944aaecdcf4478e04be4b48cdab6.svg\" alt=\"$3 > r$&#187; data-tex=&#187;inline&#187;\/>, \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5ef\/4a0\/ca9\/5ef4a0ca952e090ce3438f31407bafc4.svg\" alt=\"$n = 6$\" data-tex=\"inline\"\/> \u0432\u044b\u0431\u0440\u0430\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/371\/e5f\/40c\/371e5f40c3c624dc8d237a291060c142.svg\" alt=\"$k = 2$\" data-tex=\"inline\"\/> (\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0441 \u0434\u0432\u0443\u043c\u044f \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u043c\u0438 \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438 \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b), \u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u0440\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c 2. \u042d\u0442\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/46d\/996\/1ee\/46d9961ee3a3085be09124b0702ce117.svg\" alt=\"$2 \u2264 r$\" data-tex=\"inline\"\/>, \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/li>\n<li>\u0414\u043b\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/45b\/b59\/103\/45bb5910317b96d9da4a674d52075cbd.svg\" alt=\"$n = 3$\" data-tex=\"inline\"\/>) \u0432\u0441\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443, \u0437\u043d\u0430\u0447\u0438\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/738\/f4e\/57e\/738f4e57e0acafbb8c08262daa540b90.svg\" alt=\"$k = 1$\" data-tex=\"inline\"\/>, \u0447\u0442\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/af9\/11a\/814\/af911a814e8f8320db76968f3dbb06fa.svg\" alt=\"$1 \u2264 r$\" data-tex=\"inline\"\/>.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/011\/14f\/9cc\/01114f9cc5c39d5b8cfd1f3cc0fa65b8.svg\" alt=\"$P (1 \u2264 R \u2264 100)$\" data-tex=\"inline\"\/> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0432\u0430 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/35b\/a56\/5f3\/35ba565f36734f3a55aa01ac67868762.svg\" alt=\"$n$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b88\/ce3\/99f\/b88ce399fda6c8123ab168cb507210f2.svg\" alt=\"$r$\" data-tex=\"inline\"\/>. <strong>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/strong>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9d7\/68b\/868\/9d768b868d5e784d4a2eda39bf4568b2.svg\" alt=\"$2 &lt; n &lt; 10^{18}$\" data-tex=\"inline\"\/>, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/adc\/b9d\/2ef\/adcb9d2ef5042a53a735569e8bceb631.svg\" alt=\"$1 \u2264 r &lt; 10^{7}$\" data-tex=\"inline\"\/>.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0447\u0438\u0441\u0435\u043b \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/>, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0435\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044e. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0443. \u0415\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f7d\/d71\/a04\/f7dd71a044e4b0ff952e36c2deeaebfd.svg\" alt=\"$n \u2264 r$\" data-tex=\"inline\"\/>, \u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043b\u044e\u0431\u043e\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d4a\/c7f\/4b6\/d4ac7f4b6821aecb794f61695d169e22.svg\" alt=\"$1$\" data-tex=\"inline\"\/>. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/737\/c95\/1b1\/737c951b10a1f516974a973f3ec4ab86.svg\" alt=\"$n > r$&#187; data-tex=&#187;inline&#187;\/> \u2014 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0417\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0432 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435. \u0422\u043e\u0433\u0434\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/746\/4f2\/430\/7464f24301acf295f3c1a98ff45fca2a.svg\" alt=\"$\\lfloor \\frac{N}{2} \\rfloor$\" data-tex=\"inline\"\/> \u2014 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0439 \u043e\u0442 \u043d\u0435\u0451 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/738\/f4e\/57e\/738f4e57e0acafbb8c08262daa540b90.svg\" alt=\"$k = 1$\" data-tex=\"inline\"\/>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5ef\/4a0\/ca9\/5ef4a0ca952e090ce3438f31407bafc4.svg\" alt=\"$n = 6$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/077\/0a8\/c06\/0770a8c063dd1e6923c202e0f044bcbc.svg\" alt=\"$n = 7$\" data-tex=\"inline\"\/> \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c5c\/7df\/b89\/c5c7dfb89bad04b7780b3c5f42c8b20c.svg\" alt=\"$3$\" data-tex=\"inline\"\/>. \u041a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432, \u0435\u0441\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/>? \u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043e\u0441\u0435\u0434\u043d\u044e\u044e \u0442\u043e\u0447\u043a\u0443, \u043d\u043e \u0438 \u00ab\u043f\u0440\u044b\u0433\u0430\u0442\u044c\u00bb \u0447\u0435\u0440\u0435\u0437 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/91d\/a00\/3e6\/91da003e6f953e62f101d9dba42db361.svg\" alt=\"$k-1$\" data-tex=\"inline\"\/> \u0442\u043e\u0447\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e40\/a0f\/5f5\/e40a0f5f58bb60ba12d845c239bd2a4f.svg\" alt=\"$\\lfloor \\frac{N}{2} \\rfloor = 12$\" data-tex=\"inline\"\/>, \u0442\u043e \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fa9\/3a9\/e99\/fa93a9e99b53c2a9cd3774f04eadd6ba.svg\" alt=\"$k = 3$\" data-tex=\"inline\"\/> \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430\u0445 \u043e\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439. <\/p>\n<p>  \u0410 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/746\/4f2\/430\/7464f24301acf295f3c1a98ff45fca2a.svg\" alt=\"$\\lfloor \\frac{N}{2} \\rfloor$\" data-tex=\"inline\"\/> \u043d\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fce\/525\/2bd\/fce5252bde946816c2cf744d932890f7.svg\" alt=\"$k$\" data-tex=\"inline\"\/> \u0431\u0435\u0437 \u043e\u0441\u0442\u0430\u0442\u043a\u0430? \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u0443\u0442\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0435\u0440\u0435\u0445\u043e\u0434. \u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f: \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043e\u0442\u0432\u0435\u0442\u0443 \u0438\u043b\u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/627\/36e\/a85\/62736ea85549ba9ce1f1d071302549af.svg\" alt=\"$k_{min} =\\max( \\lceil \\frac{\\lfloor \\frac{N}{2} \\rfloor}{r} \\rceil,1) $\" data-tex=\"inline\"\/>. \u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u0445\u043e\u0442\u044f \u0431\u044b \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u0441\u0435\u0434\u043e\u043c. \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u044b <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/872\/f91\/ae5\/872f91ae573b4b3da16f816407e5f5fb.svg\" alt=\"$\\lfloor \\frac{N}{2} \\rfloor &lt; r$\" data-tex=\"inline\"\/> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/502\/f96\/0ea\/502f960ea92bcba31646e66cccd41554.svg\" alt=\"$0$\" data-tex=\"inline\"\/>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/694\/3fe\/329\/6943fe329b19ee1f40213dc3f8ee25c5.svg\" alt=\"$n = 8$\" data-tex=\"inline\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f9d\/446\/0f3\/f9d4460f3e9c3a43cb0759f341c613a8.svg\" alt=\"$k = 5$\" data-tex=\"inline\"\/>.  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u0414\u0430\u0442\u044b\u00bb<\/h2>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0438 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 <code>stdin<\/code> \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>d1<\/code> \u0438 <code>d2<\/code> \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD, \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0434\u043d\u044f\u0445. \u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 Bash 5.1.4 (\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u043e\u0434 Ubuntu 20.04).<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u0414\u0432\u0435 \u0434\u0430\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD.<\/p>\n<h4>\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u041e\u0434\u043d\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u2014 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0434\u043d\u044f\u0445.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>date<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0430\u0442\u0443 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0435\u0451 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 unix time. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043c, \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0439\u0434\u0451\u043c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043c \u0435\u0451 \u0432 \u0434\u043d\u0438:<\/p>\n<ol>\n<li>\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u0442\u044b \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430:<br \/> \n<pre><code class=\"bash\">read s1 s2 d1=`date -d \"$s1\" \"+%Y-%m-%d\"` d2=`date -d \"$s2\" \"+%Y-%m-%d\"` <\/code><\/pre>\n<\/li>\n<li>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0434\u0430\u0442\u044b \u0432 unix time:<br \/> \n<pre><code class=\"bash\">ut1=`date -d \"$d1\" +%s` ut2=`date -d \"$d2\" +%s` <\/code><\/pre>\n<\/li>\n<li>\u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u043a\u0443\u043d\u0434 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432 \u0434\u043d\u0438:<br \/> \n<pre><code class=\"bash\">diff=$(($ut1 - $ut2)) diff_days=$(($diff \/ (60 * 60 * 24))) <\/code><\/pre>\n<\/li>\n<li>\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 (\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>if<\/code>, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u00ab\u0447\u0438\u0442\u00bb \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u0435\u0435: \u043e\u043d \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043c\u0438\u043d\u0443\u0441, \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c):<br \/> \n<pre><code class=\"bash\">echo ${diff_days#-} <\/code><\/pre>\n<\/li>\n<\/ol>\n<p>  \u0411\u043e\u043d\u0443\u0441: \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430 \u0437\u0430\u0431\u0430\u0432\u043d\u044b\u0445 \u0444\u0430\u043a\u0442\u0430:<\/p>\n<ol>\n<li>\u0412\u043e \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u0432\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0442\u0430 \u0438\u0434\u0451\u0442 \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0437\u0436\u0435 \u043f\u0435\u0440\u0432\u043e\u0439.<\/li>\n<li>\u0424\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u0442\u044b \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0440\u0441\u0438\u0442\u044c, \u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0432 unix time.<\/li>\n<\/ol>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">read d1 d2  ut1=`date -d $d1 +%s` ut2=`date -d $d2 +%s`  diff=$(($ut2 - $ut1)) diff_days=$(($diff \/ (60 * 60 * 24)))  echo $diff_days <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u0410\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0434\u0430\u0436\u00bb<\/h2>\n<p>  \u0412 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>Invoice<\/code>, <code>Customer<\/code>, <code>Employee<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/post_images\/3fe\/1a6\/01c\/3fe1a601c533d845f5b533fed4b34ca2.jpg\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3fe\/1a6\/01c\/3fe1a601c533d845f5b533fed4b34ca2.jpg\" data-blurred=\"true\"\/><\/div>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u0440\u0435\u0445 \u043f\u0440\u043e\u0434\u0430\u0432\u0446\u043e\u0432 \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0435, \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0430\u0436, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2010 \u0433\u043e\u0434\u0430. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043c\u044f \u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u044f \u043f\u0440\u043e\u0434\u0430\u0432\u0446\u0430, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0445 \u043f\u0440\u043e\u0434\u0430\u0436, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Chinook Database \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SQLite \u2014 \u0441\u043c. \u0444\u0430\u0439\u043b <a href=\"https:\/\/cups.online\/api_v2\/task\/1225\/124\">Chinook_Sqlite.sqlite<\/a>. \u0422\u0430\u043a\u0436\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442\u0430 \u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u0438 \u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u043e\u044f\u0441\u043d\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a join-\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u043e\u0434\u0430\u0436 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0430\u0432\u0446\u0430. <code>Invoice<\/code> \u0438 <code>\u0421ustomer<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e <code>CustomerId<\/code>, \u0430 <code>\u0421ustomer<\/code> \u0438 <code>Employee<\/code> \u043f\u043e <code>Customer.SupportRepId = Employee.EmployeeId<\/code>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2010 \u0433\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>CAST<\/code> \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c, \u043b\u0438\u0431\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c <code>LIKE \u00ab201%\u00bb<\/code>, \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0444\u0430\u043c\u0438\u043b\u0438\u044e \u0438 \u0438\u043c\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0443\u044e \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e. \u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">SELECT     Employee.FirstName || ' ' || Employee.LastName as Name,     COUNT(Customer.SupportRepId) AS Total FROM     Invoice INNER JOIN     Customer ON     Invoice.CustomerId = Customer.CustomerId INNER JOIN     Employee ON     Customer.SupportRepId = Employee.EmployeeId WHERE     Invoice.InvoiceDate LIKE \"201%\" GROUP BY Name ORDER BY Total DESC LIMIT 3 <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430 \u00ab\u0422\u0440\u0435\u043a\u0438\u00bb<\/h2>\n<p>  \u0412 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>Invoice<\/code>, <code>InvoiceLine<\/code>, <code>Track<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/post_images\/733\/fdc\/9d4\/733fdc9d434c3984c2b69c4fd41e39c0.jpg\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/733\/fdc\/9d4\/733fdc9d434c3984c2b69c4fd41e39c0.jpg\" data-blurred=\"true\"\/><\/div>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0442\u0440\u0435\u043a\u043e\u0432 \u043f\u043e \u0438\u0445 \u043f\u0440\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2010 \u0433\u043e\u0434\u0430. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u0432\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c <code>Id<\/code> \u0442\u0440\u0435\u043a\u0430, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044f, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043f\u0438\u0439 \u0442\u0440\u0435\u043a\u0430, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 Chinook Database \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 SQLite \u2014 \u0441\u043c. \u0444\u0430\u0439\u043b <a href=\"https:\/\/cups.online\/api_v2\/task\/1225\/124\">Chinook_Sqlite.sqlite<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>INNER JOIN<\/code>. \u041e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 <code>TrackId<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 <code>Track<\/code> \u0438 <code>InvoiceLine<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 <code>InvoiceId<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 <code>InvoiceLine<\/code> \u0438 <code>Invoice<\/code>. \u0417\u0430\u0442\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2010 \u0433\u043e\u0434\u0430. \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430: \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a \u0434\u0430\u0442\u0430\u043c <code>CAST<\/code> \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c, \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>LIKE \u00ab201%\u00bb<\/code>.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043f\u0440\u043e\u0434\u0430\u0436 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0440\u0435\u043a\u0443: \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>SUM<\/code> \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <code>InvoiceLine.Quantity<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"sql\">SELECT     Track.TrackId AS TrackId,     SUM(InvoiceLine.Quantity) AS Total FROM     Track INNER JOIN     InvoiceLine ON     Track.TrackId = InvoiceLine.TrackId INNER JOIN     Invoice ON     InvoiceLine.InvoiceId = Invoice.InvoiceId WHERE     Invoice.InvoiceDate LIKE '201%' GROUP BY Track.TrackId ORDER BY Total DESC, TrackId ASC <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u044b\u043b\u0438 \u0432 \u043e\u0442\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u043c \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0440\u0430\u0443\u043d\u0434\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u0443\u0440\u0441 \u00ab<a href=\"https:\/\/route256.ozon.ru\/go-developer\">\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Go<\/a>\u00bb. \u041a\u0430\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u0430\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0441\u0430\u043c\u043e\u0439 \u043b\u0451\u0433\u043a\u043e\u0439, \u0430 \u043a\u0430\u043a\u0430\u044f \u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439? \u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0438\u043b\u0438 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \ud83d\ude42<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/company\/vk\/blog\/660489\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u041a\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             9.09%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041c\u0430\u0441\u043a\u0438<\/span> <span class=\"tm-article-poll__answer-votes\">             1           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:9.09%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             9.09%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0421\u043a\u043b\u0430\u0434\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             1           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:9.09%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041a\u0430\u0440\u0442\u0438\u043d\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041f\u0440\u043e\u0434\u0430\u0436\u0438<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             27.27%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0422\u0430\u0439\u043d\u044b\u0435 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u0438<\/span> <span class=\"tm-article-poll__answer-votes\">             3           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:27.27%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             36.36%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             4           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:36.36%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0414\u0430\u0442\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0410\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0434\u0430\u0436<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             0%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0422\u0440\u0435\u043a\u0438<\/span> <span class=\"tm-article-poll__answer-votes\">             0           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:0%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             36.36%           <\/span> <span class=\"tm-article-poll__answer-label\">\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/span> <span class=\"tm-article-poll__answer-votes\">             4           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:36.36%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 11 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.          \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 3 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.      <\/div>\n<\/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\/vk\/blog\/660489\/\"> https:\/\/habr.com\/ru\/company\/vk\/blog\/660489\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">3 \u0430\u043f\u0440\u0435\u043b\u044f \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 All Cups \u043f\u0440\u043e\u0448\u043b\u043e \u043e\u0442\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0443\u0440\u0441 \u00ab<a href=\"https:\/\/route256.ozon.ru\/go-developer\">\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Go<\/a>\u00bb \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u043a\u0443\u0440\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 Ozon Tech. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043c\u0438\u0434\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0435\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434\u0438\u0441\u0442\u044b All Cups \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043e\u043a: \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044b \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/91d\/218\/328\/91d2183285225edaa9b93ab1fac8dd75.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/91d\/218\/328\/91d2183285225edaa9b93ab1fac8dd75.png\"\/><\/div>\n<p>  <\/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-331881","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331881","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=331881"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/331881\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}