{"id":337740,"date":"2022-08-31T21:00:16","date_gmt":"2022-08-31T21:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=337740"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=337740","title":{"rendered":"<span>\u041d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f k (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439) \u043f\u0440\u0438 \u0431\u0440\u043e\u0441\u0430\u043d\u0438\u0438 n \u043a\u0443\u0431\u0438\u043a\u043e\u0432 (\u0447\u0430\u0441\u0442\u044c 2 \u0438\u0437 2)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/676854\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0443\u043c\u043c\u044b \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u043a\u0443\u0431\u0438\u043a\u0430\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B2%D1%91%D1%80%D1%82%D0%BA%D0%B0_%D0%BF%D0%BE%D1%81%D0%BB%D0%B5%D0%B4%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%D1%81%D1%82%D0%B5%D0%B9\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/a> [1 1 1 1 1 1] \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a (\u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432) \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\/\u0447\u0438\u0441\u043b\u0430 111111 \u043d\u0430 \u0441\u0430\u043c\u0443\/\u0441\u0430\u043c\u043e \u0441\u0435\u0431\u044f. \u041f\u043e\u0447\u0435\u043c\u0443, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435 \u043f\u0438\u0448\u0443\u0442, \u0447\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0435\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0437\u0430\u0433\u0430\u0434\u043a\u0430 (\u043c\u043e\u0436\u0435\u0442 \u044f \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u043a\u0430\u044e \u0438\u0437 \u0432\u0438\u0434\u0430 &#8212; \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u043f\u0440\u0430\u0432, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435). \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0432\u0430 \u0441\u043b\u043e\u0432\u043e\u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044f &#171;\u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439&#187; \u0438 &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e, \u0442.\u043a. \u043f\u0435\u0440\u0432\u043e\u0435 \u2014 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aaf\/ac9\/dba\/aafac9dba7b1baa8fa605ed37a077565.png\" width=\"918\" height=\"1411\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aaf\/ac9\/dba\/aafac9dba7b1baa8fa605ed37a077565.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f &#171;\u0441\u0442\u0440\u0430\u0448\u0438\u043b\u0441\u044f&#187; \u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f 1000 \u043a\u0443\u0431\u0438\u043a\u043e\u0432. \u0412\u043e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438\u043c \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<h2>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f<\/h2>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u0432\u0435\u0440\u0445\u0443, \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/676854\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0443\u043f\u043e\u0440 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u043d\u0430 &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \/ \u0441\u0432\u0451\u0440\u0442\u043a\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 [1 1 1 1 1 1], \u0438 \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c &#171;\u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c&#187; \u043d\u0430 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0435\u0449\u0451. \u0412\u043e\u0442 \u044d\u0442\u0443 \u043e\u043f\u043b\u043e\u0448\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u043f\u0440\u0430\u0437\u0434\u043d\u0438\u0442\u044c.<\/p>\n<p>\u041e\u0442\u0432\u043b\u0435\u043a\u0443\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0430 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0447\u0438\u0441\u043b\u0430 2 (<a href=\"https:\/\/habr.com\/ru\/post\/204258\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u0442\u0443\u0434\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/a> \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: <em>\u043a\u0430\u043a\u0438\u0435 \u0433\u0440\u0443\u0437\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0432\u0435\u0441\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0438\u0440\u044c \u0432 2<sup>0<\/sup>, 2<sup>1<\/sup>, 2<sup>2<\/sup>,&#8230;, 2<sup>n<\/sup> \u0433\u0440\u0430\u043c\u043c \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c?<\/em>). \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1d4\/a66\/28d\/1d4a6628d0f32dde0319f4e899bf13b5.png\" width=\"231\" height=\"591\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d4\/a66\/28d\/1d4a6628d0f32dde0319f4e899bf13b5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0447\u0438\u0441\u043b\u0430 a<sup>63<\/sup> \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a: a<sup>63<\/sup> = a<sup>1 + 2 + 4 + \u2026 + 32<\/sup> = a<sup>1<\/sup> * a<sup>2<\/sup> * a<sup>4<\/sup> * \u2026 * a<sup>32<\/sup>. \u0422\u043e \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e I \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u0443\u043c\u0435\u044f \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c\/\u0441\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 63-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u0441\u0442\u0435\u043f\u0435\u043d\u044c 63) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\/\u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0431\u043a\u0430\u0442\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \u043d\u0430 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u041f\u0430\u0441\u043a\u0430\u043b\u044f. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0439\u0442\u0438 9-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0437\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e I \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u0438\u043c\u0435\u043d\u043d\u043e [1 1]) \u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; [1 1] \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f (<a href=\"https:\/\/qastack.ru\/codegolf\/80030\/discrete-convolution-or-polynomial-multiplication\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435<\/a>), \u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0441\u0435\u043b \u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 [1 1]. \u0417\u0432\u0443\u0447\u0438\u0442 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ca2\/bfc\/983\/ca2bfc983a0a9ef15409f8eacd0750a6.png\" width=\"523\" height=\"172\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca2\/bfc\/983\/ca2bfc983a0a9ef15409f8eacd0750a6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 9-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c45\/12e\/e02\/c4512ee02ea985a52e053fa2710f0afb.png\" width=\"791\" height=\"1341\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c45\/12e\/e02\/c4512ee02ea985a52e053fa2710f0afb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435. \u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<details class=\"spoiler\">\n<summary>Python. \u041f\u0440\u0438\u043c\u0435\u0440. II, IV, VIII, XI \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import numpy  convolve_out = numpy.convolve([1, 1], [1, 1]) # [1 2 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [1 4 6 4 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [ 1 8 28 56 70 56 28 8 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, [1, 1]) # [ 1 9 36 84 126 126 84 36 9 1] print(convolve_out) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, I \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h2>\n<p>\u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441 \u043a\u0443\u0431\u0438\u043a\u0430\u043c\u0438, \u0438 \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0443\u043c\u043c\u044b \u043a\u043e\u0441\u0442\u0435\u0439 19 \u0434\u043b\u044f 5 \u043a\u0443\u0431\u0438\u043a\u043e\u0432. \u0422.\u0435. \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c [1 1 1 1 1 1] \u0438 \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e 5-\u043e\u0433\u043e \u043a\u0443\u0431\u0438\u043a\u0430 (\u0441\u0442\u0435\u043f\u0435\u043d\u044c 5) \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187;:<\/p>\n<p> a<sup>1<\/sup> * a<sup>1<\/sup> = a<sup>2<\/sup><\/p>\n<p> a<sup>2<\/sup> * a<sup>2<\/sup> = a<sup>4<\/sup><\/p>\n<p> a<sup>1<\/sup> * a<sup>4<\/sup> = a<sup>5<\/sup><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eaf\/75f\/83f\/eaf75f83f78db071eea4801167f49ad1.png\" width=\"1458\" height=\"2041\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eaf\/75f\/83f\/eaf75f83f78db071eea4801167f49ad1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u201c\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u201d \u0432 \u201c\u042d\u0442\u0430\u043f I. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f 2-\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432\/\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432: \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) \u0418 \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u201d \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ \u201c\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u201d.<\/p>\n<details class=\"spoiler\">\n<summary>Python. \u041f\u0440\u0438\u043c\u0435\u0440. \u0421\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 [1 1 1 1 1 1]<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import numpy  convolve_out = numpy.convolve([1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]) # [1 2 3 4 5 6 5 4 3 2 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [ 1 4 10 20 35 56 80 104 125 140 146 140 125 104 80 56 35 20 10 4 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, [1, 1, 1, 1, 1, 1]) # [ 1 5 15 35 70 126 205 305 420 540 651 735 780 780 735 651 540 420 305 205 126 70 35 15 5 1] print(convolve_out) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u043a\u0440\u0438\u043f\u0442\u044b, I \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h2>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0430. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043b\u0435\u043a\u0430\u043b\u0430\u043c. \u041f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>Python<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  def main():     c_int_side_dice: int = 6  # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     c_int_dice_number: int = 1000  # \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     c_int_number_to_find: int = 2000  # \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice)     print(probability)   # \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f def dice_probability(int_dice_number: int, int_number_to_find: int, c_int_side_dice: int) -> float:     if int_number_to_find >= int_dice_number and int_number_to_find &lt;= c_int_side_dice * int_dice_number:         list_values: list[int] = [i for i in range(int_dice_number, c_int_side_dice * int_dice_number + 1)]         list_interm_probability = interm_probabilities(c_int_side_dice, int_dice_number)          for i in range(len(list_values)):             if list_values[i] == int_number_to_find:                 int_out: int = list_interm_probability[i]                 break         return int_out \/ (c_int_side_dice ** int_dice_number)     else:         # \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         return 0.0   # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 def interm_probabilities(int_side_dice: int, int_pow: int) -> list[int]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     {       1: [1, 1, 1, 1, 1, 1],       2: [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1],       4: [1, 4, 10, 20, 35, 56, 80, 104, 125, 140, 146, 140, 125, 104, 80, 56, 35, 20, 10, 4, 1]       5: [1, 5, 15, 35, 70, 126, 205, 305, 420, 540, 651, 735, 780, 780, 735, 651, 540, 420, 305, 205, 126, 70, 35, 15, 5, 1]     }     \"\"\"     dict_interm_probability: dict[int, list[int]] = {1: [1] * int_side_dice}     if int_pow == 0:         print(\"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\")         quit()     elif int_pow != 1:         list_to_do = map_todo(int_pow)          for elem in list_to_do:             dict_interm_probability[elem[2]] = multiply_cins_orig(dict_interm_probability[elem[0]], dict_interm_probability[elem[1]])     return dict_interm_probability[int_pow]   # \u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 def map_todo(int_wanted: int) -> list[tuple[int, int, int]]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     1     1 * 2 = 2 -> tuple(1, 1, 2)     2 * 2 = 4 -> tuple(2, 2, 4)     4 + 1 = 5 -> tuple(4, 1, 5)     \"\"\"      int_current_id: int = 1     int_sum: int = 1     b_ascending: bool = True     list_solution: list[tuple[int, int, int]] = []      while True:         if int_sum == int_wanted:             break         elif b_ascending and 2 * int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_current_id, int_current_id, 2 * int_current_id)             )             int_current_id = 2 * int_current_id             int_sum = int_current_id         elif b_ascending and 2 * int_current_id > int_wanted:             b_ascending = False             int_sum = int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_sum, int_current_id, int_sum + int_current_id)             )             int_sum = int_sum + int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id > int_wanted:             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer     return list_solution   # \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 def multiply_cins_orig(list_in_1: list[int], list_in_2: list[int]) -> list[int]:     int_len_2: int = len(list_in_2)     list_dummy: list[list[int]] = []     for i in range(int_len_2):         list_dummy.append([0] * i)  # [], [0], [0, 0], [0, 0, 0] ...      list_for_sum: list[list[int]] = []     i: int = -1     for elem_2 in list_in_2:         i += 1         list_interm: list[int] = [elem_1 * elem_2 for elem_1 in list_in_1]         list_for_sum.append(list_dummy[i] + list_interm + list_dummy[int_len_2 - i - 1])      \"\"\"     [list_in_1 X elem_2[0], 0, 0, 0, 0, 0]     [0, list_in_1 X elem_2[1], 0, 0, 0, 0]     [0, 0, list_in_1 X elem_2[2], 0, 0, 0]     [0, 0, 0, list_in_1 X elem_2[3], 0, 0]     [0, 0, 0, 0, list_in_1 X elem_2[4], 0]     [0, 0, 0, 0, 0, list_in_1 X elem_2[5]]     \"\"\"      list_out: list[int] = []     for i in range(len(list_for_sum[0])):         sum_out: int = 0         for j in range(int_len_2):             sum_out += list_for_sum[j][i]         list_out.append(sum_out)     \"\"\"     [1, 3, 6, 10, 15, 21, 25, 27, 27, 25, 21, 15, 10, 6, 3, 1]     \"\"\"     return list_out   main() <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>JavaScript<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"javascript\">function main(){     const c_int_side_dice = 6;  \/\/ \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     const c_int_dice_number = 100; \/\/ \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     const c_int_number_to_find = 300; \/\/ \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     let probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice);     console.log(probability); }   \/\/ \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f function dice_probability(int_dice_number, int_number_to_find, c_int_side_dice){     if (int_number_to_find >= int_dice_number &amp;&amp; int_number_to_find &lt;= c_int_side_dice * int_dice_number){         let list_values = new Array();         let i = 0;         for (let j = int_dice_number; j &lt;= c_int_side_dice * int_dice_number; j++){             list_values[i] = j;             i++;         }         let list_interm_probability = interm_probabilities(c_int_side_dice, int_dice_number);         let int_out;         for (let i = 0; i &lt;= list_values.length; i++){             if (list_values[i] == int_number_to_find){                 int_out = list_interm_probability[i];                 break;             }         }         return int_out \/ Math.pow(c_int_side_dice, int_dice_number);     } else {         \/\/ \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         return 0.0;     } }  \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 function interm_probabilities(int_side_dice, int_pow){     \/\/ \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     \/\/ {     \/\/   1: [1, 1, 1, 1, 1, 1],     \/\/   2: [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1],     \/\/   4: [1, 4, 10, 20, 35, 56, 80, 104, 125, 140, 146, 140, 125, 104, 80, 56, 35, 20, 10, 4, 1]     \/\/   5: [1, 5, 15, 35, 70, 126, 205, 305, 420, 540, 651, 735, 780, 780, 735, 651, 540, 420, 305, 205, 126, 70, 35, 15, 5, 1]     \/\/ }     let dict_interm_probability = {1: Array(int_side_dice).fill(1)};     if (int_pow == 0){         console.log(\"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\");         return;     } else if (int_pow != 1){         let list_to_do = map_todo(int_pow);          for (let i = 0; i &lt; list_to_do.length; i++){             dict_interm_probability[list_to_do[i][2]] = multiply_cins_orig(dict_interm_probability[list_to_do[i][0]], dict_interm_probability[list_to_do[i][1]]);         }     }     return dict_interm_probability[int_pow]; }   \/\/ \u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 function map_todo(int_wanted){     \/\/ \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     \/\/ \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     \/\/ 1     \/\/ 1 * 2 = 2 -> Array(1, 1, 2)     \/\/ 2 * 2 = 4 -> Array(2, 2, 4)     \/\/ 4 + 1 = 5 -> Array(4, 1, 5)      let int_current_id = 1;     let int_sum = 1;     let b_ascending = true;     let list_solution = new Array();     let i = 0;     while (true){         if (int_sum == int_wanted){             break;         } else if (b_ascending &amp;&amp; 2 * int_current_id &lt;= int_wanted){             list_solution[i] = [int_current_id, int_current_id, 2 * int_current_id];  \/\/ mult_1, mult_2, result             i++;             int_current_id = 2 * int_current_id;             int_sum = int_current_id;         } else if (b_ascending &amp;&amp; 2 * int_current_id > int_wanted){             b_ascending = false;             int_sum = int_current_id;             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         } else if (!b_ascending &amp;&amp; int_sum + int_current_id &lt;= int_wanted){             list_solution[i] = [int_sum, int_current_id, int_sum + int_current_id];  \/\/ mult_1, mult_2, result             i++;             int_sum = int_sum + int_current_id;             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         } else if (!b_ascending &amp;&amp; int_sum + int_current_id > int_wanted){             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         }     }     return list_solution; }  \/\/ \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 function multiply_cins_orig(list_in_1, list_in_2){     let int_len_1 = list_in_1.length;     let int_len_2 = list_in_2.length;          let list_dummy = new Array();     for (let j = 0; j &lt; int_len_2; j++){         list_dummy[j] = Array(j).fill(0);  \/\/ [], [0], [0, 0], [0, 0, 0] ...     }      let list_for_sum = new Array();     for (let j = 0; j &lt; int_len_2; j++){         let list_interm = new Array();         for (let i = 0; i &lt; int_len_1; i++){             list_interm[i] = list_in_1[i] * list_in_2[j]         }         list_for_sum[j] = list_dummy[j].concat(list_interm, list_dummy[int_len_2 - j - 1]);     }          \/\/ [list_in_1 X elem_2[0], 0, 0, 0, 0, 0]     \/\/ [0, list_in_1 X elem_2[1], 0, 0, 0, 0]     \/\/ [0, 0, list_in_1 X elem_2[2], 0, 0, 0]     \/\/ [0, 0, 0, list_in_1 X elem_2[3], 0, 0]     \/\/ [0, 0, 0, 0, list_in_1 X elem_2[4], 0]     \/\/ [0, 0, 0, 0, 0, list_in_1 X elem_2[5]]           let list_out = new Array();     for (let i = 0; i &lt; list_for_sum[0].length; i++){         let sum_out = 0;         for (let j = 0; j &lt; int_len_2; j++){             sum_out += list_for_sum[j][i];         }         list_out[i] = sum_out;     }      \/\/ [1, 3, 6, 10, 15, 21, 25, 27, 27, 25, 21, 15, 10, 6, 3, 1]     return list_out; }  main();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>VBS<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"vbscript\">Option Explicit   Sub main()     Const c_int_side_dice = 6  '\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     Const c_int_dice_number = 100  '\u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     Const c_int_number_to_find = 200  '\u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     Dim probability     probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice)     MsgBox probability End Sub   ' \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f Function dice_probability(int_dice_number, int_number_to_find, c_int_side_dice)     If int_number_to_find >= int_dice_number And int_number_to_find &lt;= c_int_side_dice * int_dice_number Then         ReDim list_values(int_dice_number * (c_int_side_dice - 1))         Dim i, j         i = 0         For j = int_dice_number To c_int_side_dice * int_dice_number             list_values(i) = j             i = i + 1         Next Dim list_interm_probability() interm_probabilities c_int_side_dice, int_dice_number, list_interm_probability For i = 0 To int_dice_number * (c_int_side_dice - 1) If list_values(i) = int_number_to_find Then Exit For End If Next dice_probability = list_interm_probability(i) \/ (c_int_side_dice ^ int_dice_number)     Else         '\u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         dice_probability = 0.0     End If End Function   '\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Sub interm_probabilities(int_side_dice, int_pow, list_out)     '\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     '{     '  1: [1, 1, 1, 1, 1, 1],     '  2: [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1],     '  4: [1, 4, 10, 20, 35, 56, 80, 104, 125, 140, 146, 140, 125, 104, 80, 56, 35, 20, 10, 4, 1]     '  5: [1, 5, 15, 35, 70, 126, 205, 305, 420, 540, 651, 735, 780, 780, 735, 651, 540, 420, 305, 205, 126, 70, 35, 15, 5, 1]     '}     Dim j     Dim list_interm_probability()     ReDim list_interm_probability(int_side_dice - 1)     For j = 0 To int_side_dice - 1         list_interm_probability(j) = 1     Next     Dim dict_interm_probability     Set dict_interm_probability = CreateObject(\"Scripting.Dictionary\")     dict_interm_probability.Add 1, list_interm_probability      If int_pow = 0 Then         MsgBox \"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\"         Quit     ElseIf int_pow &lt;> 1 Then         Dim list_to_do()         map_todo list_to_do, int_pow         For j = 0 To UBound(list_to_do, 2)             'MsgBox list_to_do(0, j) &amp; vbTab &amp; list_to_do(1, j) &amp; vbTab &amp; list_to_do(2, j)             multiply_cins_orig _                 dict_interm_probability.Item(list_to_do(0, j)), _                 dict_interm_probability.Item(list_to_do(1, j)), _                 list_out             dict_interm_probability.Add list_to_do(2, j), list_out             ' ArrOut_1 list_out         Next     End If End Sub   '\u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 Sub map_todo(list_solution, int_wanted)     '\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     '\u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     '1     '1 * 2 = 2 -> Array(1, 1, 2)     '2 * 2 = 4 -> Array(2, 2, 4)     '4 + 1 = 5 -> Array(4, 1, 5)      Dim int_current_id     Dim int_sum     Dim b_ascending     Dim i          int_current_id = 1     int_sum = 1     b_ascending = True     i = -1      Do         If b_ascending And 2 * int_current_id &lt;= int_wanted Then             i = i + 1             ReDim Preserve list_solution(2, i)             list_solution(0, i) = int_current_id             list_solution(1, i) = int_current_id             list_solution(2, i) = 2 * int_current_id             int_current_id = 2 * int_current_id             int_sum = int_current_id         ElseIf b_ascending And 2 * int_current_id > int_wanted Then             b_ascending = False             int_sum = int_current_id             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         ElseIf Not b_ascending And int_sum + int_current_id &lt;= int_wanted Then             i = i + 1             ReDim Preserve list_solution(2, i)             list_solution(0, i) = int_sum             list_solution(1, i) = int_current_id             list_solution(2, i) = int_sum + int_current_id             int_sum = int_sum + int_current_id             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         ElseIf Not b_ascending And int_sum + int_current_id > int_wanted Then             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         End If     Loop Until (int_sum = int_wanted) End Sub   ' \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 Sub multiply_cins_orig(list_in_1, list_in_2, list_in)     Dim int_len_1     Dim int_len_2     int_len_1 = Ubound(list_in_1, 1)     int_len_2 = Ubound(list_in_2, 1)      Dim list_for_sum()     ReDim list_for_sum(int_len_2, int_len_1 + int_len_2)     Dim i, j, k, n     For i = 0 To int_len_2         j = 0         For n = 0 To int_len_2             If i = n Then                 For k = 0 To int_len_1                     list_for_sum(i, j) = list_in_1(k) * list_in_2(n)                     j = j + 1                 Next             Else                 list_for_sum(i, j) = 0                 j = j + 1             End If         Next     Next     '[list_in_1 X elem_2[0], 0, 0, 0, 0, 0]     '[0, list_in_1 X elem_2[1], 0, 0, 0, 0]     '[0, 0, list_in_1 X elem_2[2], 0, 0, 0]     '[0, 0, 0, list_in_1 X elem_2[3], 0, 0]     '[0, 0, 0, 0, list_in_1 X elem_2[4], 0]     '[0, 0, 0, 0, 0, list_in_1 X elem_2[5]]      'ArrOut_2 list_for_sum     Erase list_in     ReDim list_in(int_len_1 + int_len_2)     Dim sum_out     For j = 0 To int_len_1 + int_len_2         sum_out = 0         For i = 0 To int_len_2             sum_out = sum_out + list_for_sum(i, j)         Next         list_in(j) = sum_out     Next     ' [1, 3, 6, 10, 15, 21, 25, 27, 27, 25, 21, 15, 10, 6, 3, 1]     'ArrOut_1 list_in End Sub   '================================================== '&lt;Additional_MsgBox_For_Arrays> Sub ArrOut_1(arr_in)     Dim str_out     Dim i     For i = 0 To UBound(arr_in)         If i = 0 Then             str_out = arr_in(i)         Else             str_out = str_out &amp; \" \" &amp; arr_in(i)         End If     Next     MsgBox str_out End Sub  Sub ArrOut_2(arr_in)     Dim str_out     Dim i, j     For i = 0 To UBound(arr_in, 1)         For j = 0 To UBound(arr_in, 2)             If i = 0 And j = 0 Then                 str_out = arr_in(i, j)             ElseIf j = 0 Then                 str_out = str_out &amp; vbNewLine &amp; arr_in(i, j)             Else                 str_out = str_out &amp; \" \" &amp; arr_in(i, j)             End If         Next     Next     MsgBox str_out End Sub '&lt;\/Additional_MsgBox_For_Arrays> '==================================================  main<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, II \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0435\u0441\u0442\u043d\u044b\u043c, \u0442\u043e \u0438\u0437 3-\u0445 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043e 1000-\u0433\u043e \u043a\u0443\u0431\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e Python (<u>\u0431\u0435\u0437<\/u> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 numpy), \u0430 JavaScript \u0438 VBS \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c: \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187;, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e. \u0422.\u0435. \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c [1\/6 1\/6 1\/6 1\/6 1\/6 1\/6] \u0432\u043c\u0435\u0441\u0442\u043e [1 1 1 1 1 1] \u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \/ \u043c\u0430\u0441\u0441\u0438\u0432 \/ \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2cd\/5ce\/2c7\/2cd5ce2c7ca1eac919a5661fe46a128a.png\" width=\"1498\" height=\"1951\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2cd\/5ce\/2c7\/2cd5ce2c7ca1eac919a5661fe46a128a.png\"\/><figcaption><\/figcaption><\/figure>\n<details class=\"spoiler\">\n<summary>Python. \u041f\u0440\u0438\u043c\u0435\u0440. \u0421\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 [1\/6 1\/6 1\/6 1\/6 1\/6 1\/6]<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0434\u0440\u043e\u0431\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c &#8212; \u0434\u0435\u043b\u043e \u043d\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0435, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c 6 ** n * &#8230; &#8212; \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import numpy  convolve_out = numpy.convolve([1 \/ 6] * 6, [1 \/ 6] * 6) # [1 2 3 4 5 6 5 4 3 2 1] print(6 ** 2 * convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [ 1 4 10 20 35 56 80 104 125 140 146 140 125 104 80 56 35 20 10 4 1] print(6 ** 4 * convolve_out )  convolve_out = numpy.convolve(convolve_out, [1 \/ 6] * 6) # [ 1 5 15 35 70 126 205 305 420 540 651 735 780 780 735 651 540 420 305 205 126 70 35 15 5 1] print(6 ** 5 * convolve_out) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u043a\u0440\u0438\u043f\u0442\u044b, II \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h3>\n<p>\u0414\u043e 1000-\u0433\u043e \u043a\u0443\u0431\u0438\u043a\u0430 \u0434\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435. \u041f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>Python<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*- # import numpy  # &lt;\u043c\u043e\u0436\u043d\u043e_\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c_numpy>  def main():     c_int_side_dice: int = 6  # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     c_int_dice_number: int = 1000  # \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     c_int_number_to_find: int = 2000  # \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice)     print(probability)   # \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f def dice_probability(int_dice_number: int, int_number_to_find: int, c_int_side_dice: int) -> float:     if int_number_to_find >= int_dice_number and int_number_to_find &lt;= c_int_side_dice * int_dice_number:         list_values: list[int] = [i for i in range(int_dice_number, c_int_side_dice * int_dice_number + 1)]         list_probability = get_probabilities(c_int_side_dice, int_dice_number)          for i in range(len(list_values)):             if list_values[i] == int_number_to_find:                 float_out: float = list_probability[i]                 break         return float_out     else:         # \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         return 0.0   # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0430\u0434\u0435\u043d\u0438\u044f def get_probabilities(int_side_dice: int, int_pow: int) -> list[float]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     {       1: [1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6],       2: [1 \/ 36, 2 \/ 36, 3 \/ 36, 4 \/ 36, 5 \/ 36, 6 \/ 36, 5 \/ 36, 4 \/ 36, 3 \/ 36, 2 \/ 36, 1 \/ 36],       4: [1 \/ 1296, 4 \/ 1296, 10 \/ 1296, 20 \/ 1296, 35 \/ 1296, 56 \/ 1296, 80 \/ 1296, 104 \/ 1296, 125 \/ 1296, 140 \/ 1296, 146 \/ 1296, 140 \/ 1296, 125 \/ 1296, 104 \/ 1296, 80 \/ 1296, 56 \/ 1296, 35 \/ 1296, 20 \/ 1296, 10 \/ 1296, 4 \/ 1296, 1 \/ 1296]       5: [1 \/ 7776, 5 \/ 7776, 15 \/ 7776, 35 \/ 7776, 70 \/ 7776, 126 \/ 7776, 205 \/ 7776, 305 \/ 7776, 420 \/ 7776, 540 \/ 7776, 651 \/ 7776, 735 \/ 7776, 780 \/ 7776, 780 \/ 7776, 735 \/ 7776, 651 \/ 7776, 540 \/ 7776, 420 \/ 7776, 305 \/ 7776, 205 \/ 7776, 126 \/ 7776, 70 \/ 7776, 35 \/ 7776, 15 \/ 7776, 5 \/ 7776, 1 \/ 7776]     }     \"\"\"     dict_interm_probability = {1: [1 \/ int_side_dice] * int_side_dice}     if int_pow == 0:         print(\"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\")         quit()     elif int_pow != 1:         list_to_do = map_todo(int_pow)          for elem in list_to_do:             dict_interm_probability[elem[2]] = multiply_cins_orig(dict_interm_probability[elem[0]], dict_interm_probability[elem[1]])             # dict_interm_probability[elem[2]] = numpy.convolve(dict_interm_probability[elem[0]], dict_interm_probability[elem[1]])  # &lt;\u043c\u043e\u0436\u043d\u043e_\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c_numpy> \u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c multiply_cins_orig()     return dict_interm_probability[int_pow]   # \u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 def map_todo(int_wanted: int) -> list[tuple[int, int, int]]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     1     1 * 2 = 2 -> tuple(1, 1, 2)     2 * 2 = 4 -> tuple(2, 2, 4)     4 + 1 = 5 -> tuple(4, 1, 5)     \"\"\"      int_current_id: int = 1     int_sum: int = 1     b_ascending: bool = True     list_solution: list[tuple[int, int, int]] = []      while True:         if int_sum == int_wanted:             break         elif b_ascending and 2 * int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_current_id, int_current_id, 2 * int_current_id)             )             int_current_id = 2 * int_current_id             int_sum = int_current_id         elif b_ascending and 2 * int_current_id > int_wanted:             b_ascending = False             int_sum = int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_sum, int_current_id, int_sum + int_current_id)             )             int_sum = int_sum + int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id > int_wanted:             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer     return list_solution   # \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 def multiply_cins_orig(list_in_1: list[int], list_in_2: list[int]) -> list[int]:     int_len_2: int = len(list_in_2)     list_dummy: list[list[int]] = []     for i in range(int_len_2):         list_dummy.append([0] * i)  # [], [0], [0, 0], [0, 0, 0] ...      list_for_sum: list[list[int]] = []     i: int = -1     for elem_2 in list_in_2:         i += 1         list_interm: list[int] = [elem_1 * elem_2 for elem_1 in list_in_1]         list_for_sum.append(list_dummy[i] + list_interm + list_dummy[int_len_2 - i - 1])      \"\"\"     [list_in_1 X list_in_2[0], 0, 0, 0, 0, 0]     [0, list_in_1 X list_in_2[1], 0, 0, 0, 0]     [0, 0, list_in_1 X list_in_2[2], 0, 0, 0]     [0, 0, 0, list_in_1 X list_in_2[3], 0, 0]     [0, 0, 0, 0, list_in_1 X list_in_2[4], 0]     [0, 0, 0, 0, 0, list_in_1 X list_in_2[5]]     \"\"\"      list_out: list[int] = []     for i in range(len(list_for_sum[0])):         sum_out: int = 0         for j in range(int_len_2):             sum_out += list_for_sum[j][i]         list_out.append(sum_out)     \"\"\"     [1 \/ 216, 3 \/ 216, 6 \/ 216, 10 \/ 216, 15 \/ 216, 21 \/ 216, 25 \/ 216, 27 \/ 216, 27 \/ 216, 25 \/ 216, 21 \/ 216, 15 \/ 216, 10 \/ 216, 6 \/ 216, 3 \/ 216, 1 \/ 216]     \"\"\"     return list_out   main() <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>JavaScript<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"javascript\">function main(){     const c_int_side_dice = 6;  \/\/ \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     const c_int_dice_number = 1000; \/\/ \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     const c_int_number_to_find = 2000; \/\/ \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     let probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice);     console.log(probability); }   \/\/ \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f function dice_probability(int_dice_number, int_number_to_find, c_int_side_dice){     if (int_number_to_find >= int_dice_number &amp;&amp; int_number_to_find &lt;= c_int_side_dice * int_dice_number){         let list_values = new Array();         let i = 0;         for (let j = int_dice_number; j &lt;= c_int_side_dice * int_dice_number; j++){             list_values[i] = j;             i++;         }         let list_probability = get_probabilities(c_int_side_dice, int_dice_number);         let float_out;         for (let i = 0; i &lt;= list_values.length; i++){             if (list_values[i] == int_number_to_find){                 float_out = list_probability[i];                 break;             }         }         return float_out;     } else {         \/\/ \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         return 0.0;     } }  \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0430\u0434\u0435\u043d\u0438\u044f function get_probabilities(int_side_dice, int_pow){     \/\/ \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     \/\/ {     \/\/   1: [1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6],     \/\/   2: [1 \/ 36, 2 \/ 36, 3 \/ 36, 4 \/ 36, 5 \/ 36, 6 \/ 36, 5 \/ 36, 4 \/ 36, 3 \/ 36, 2 \/ 36, 1 \/ 36],     \/\/   4: [1 \/ 1296, 4 \/ 1296, 10 \/ 1296, 20 \/ 1296, 35 \/ 1296, 56 \/ 1296, 80 \/ 1296, 104 \/ 1296, 125 \/ 1296, 140 \/ 1296, 146 \/ 1296, 140 \/ 1296, 125 \/ 1296, 104 \/ 1296, 80 \/ 1296, 56 \/ 1296, 35 \/ 1296, 20 \/ 1296, 10 \/ 1296, 4 \/ 1296, 1 \/ 1296]     \/\/   5: [1 \/ 7776, 5 \/ 7776, 15 \/ 7776, 35 \/ 7776, 70 \/ 7776, 126 \/ 7776, 205 \/ 7776, 305 \/ 7776, 420 \/ 7776, 540 \/ 7776, 651 \/ 7776, 735 \/ 7776, 780 \/ 7776, 780 \/ 7776, 735 \/ 7776, 651 \/ 7776, 540 \/ 7776, 420 \/ 7776, 305 \/ 7776, 205 \/ 7776, 126 \/ 7776, 70 \/ 7776, 35 \/ 7776, 15 \/ 7776, 5 \/ 7776, 1 \/ 7776]     \/\/ }      let dict_interm_probability = {1: Array(int_side_dice).fill(1 \/ int_side_dice)};     if (int_pow == 0){         console.log(\"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\");         return;     } else if (int_pow != 1){         let list_to_do = map_todo(int_pow);          for (let i = 0; i &lt; list_to_do.length; i++){             dict_interm_probability[list_to_do[i][2]] = multiply_cins_orig(dict_interm_probability[list_to_do[i][0]], dict_interm_probability[list_to_do[i][1]]);         }     }     return dict_interm_probability[int_pow]; }   \/\/ \u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 function map_todo(int_wanted){     \/\/ \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     \/\/ \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     \/\/ 1     \/\/ 1 * 2 = 2 -> Array(1, 1, 2)     \/\/ 2 * 2 = 4 -> Array(2, 2, 4)     \/\/ 4 + 1 = 5 -> Array(4, 1, 5)      let int_current_id = 1;     let int_sum = 1;     let b_ascending = true;     let list_solution = new Array();     let i = 0;     while (true){         if (int_sum == int_wanted){             break;         } else if (b_ascending &amp;&amp; 2 * int_current_id &lt;= int_wanted){             list_solution[i] = [int_current_id, int_current_id, 2 * int_current_id];  \/\/ mult_1, mult_2, result             i++;             int_current_id = 2 * int_current_id;             int_sum = int_current_id;         } else if (b_ascending &amp;&amp; 2 * int_current_id > int_wanted){             b_ascending = false;             int_sum = int_current_id;             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         } else if (!b_ascending &amp;&amp; int_sum + int_current_id &lt;= int_wanted){             list_solution[i] = [int_sum, int_current_id, int_sum + int_current_id];  \/\/ mult_1, mult_2, result             i++;             int_sum = int_sum + int_current_id;             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         } else if (!b_ascending &amp;&amp; int_sum + int_current_id > int_wanted){             int_current_id = Math.ceil(int_current_id \/ 2);  \/\/ \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         }     }     return list_solution; }  \/\/ \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 function multiply_cins_orig(list_in_1, list_in_2){     let int_len_1 = list_in_1.length;     let int_len_2 = list_in_2.length;          let list_dummy = new Array();     for (let j = 0; j &lt; int_len_2; j++){         list_dummy[j] = Array(j).fill(0);  \/\/ [], [0], [0, 0], [0, 0, 0] ...     }      let list_for_sum = new Array();     for (let j = 0; j &lt; int_len_2; j++){         let list_interm = new Array();         for (let i = 0; i &lt; int_len_1; i++){             list_interm[i] = list_in_1[i] * list_in_2[j]         }         list_for_sum[j] = list_dummy[j].concat(list_interm, list_dummy[int_len_2 - j - 1]);     }          \/\/ [list_in_1 X list_in_2[0], 0, 0, 0, 0, 0]     \/\/ [0, list_in_1 X list_in_2[1], 0, 0, 0, 0]     \/\/ [0, 0, list_in_1 X list_in_2[2], 0, 0, 0]     \/\/ [0, 0, 0, list_in_1 X list_in_2[3], 0, 0]     \/\/ [0, 0, 0, 0, list_in_1 X list_in_2[4], 0]     \/\/ [0, 0, 0, 0, 0, list_in_1 X list_in_2[5]]           let list_out = new Array();     for (let i = 0; i &lt; list_for_sum[0].length; i++){         let sum_out = 0;         for (let j = 0; j &lt; int_len_2; j++){             sum_out += list_for_sum[j][i];         }         list_out[i] = sum_out;     }      \/\/ [1 \/ 216, 3 \/ 216, 6 \/ 216, 10 \/ 216, 15 \/ 216, 21 \/ 216, 25 \/ 216, 27 \/ 216, 27 \/ 216, 25 \/ 216, 21 \/ 216, 15 \/ 216, 10 \/ 216, 6 \/ 216, 3 \/ 216, 1 \/ 216]     return list_out; }  main();<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>VBS<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"vbscript\">Option Explicit   Sub main()     Const c_int_side_dice = 6  '\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     Const c_int_dice_number = 1000  '\u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     Const c_int_number_to_find = 2000  '\u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     Dim probability     probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice)     MsgBox probability End Sub   ' \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f Function dice_probability(int_dice_number, int_number_to_find, c_int_side_dice)     If int_number_to_find >= int_dice_number And int_number_to_find &lt;= c_int_side_dice * int_dice_number Then         ReDim list_values(int_dice_number * (c_int_side_dice - 1))         Dim i, j         i = 0         For j = int_dice_number To c_int_side_dice * int_dice_number             list_values(i) = j             i = i + 1         Next         Dim list_probability()         get_probabilities c_int_side_dice, int_dice_number, list_probability         For i = 0 To int_dice_number * (c_int_side_dice - 1)             If list_values(i) = int_number_to_find Then                 Exit For             End If         Next         dice_probability = list_probability(i)     Else         '\u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         dice_probability = 0.0     End If End Function   '\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0430\u0434\u0435\u043d\u0438\u044f Sub get_probabilities(int_side_dice, int_pow, list_out)     '\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     '{     '  1: [1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6, 1 \/ 6],     '  2: [1 \/ 36, 2 \/ 36, 3 \/ 36, 4 \/ 36, 5 \/ 36, 6 \/ 36, 5 \/ 36, 4 \/ 36, 3 \/ 36, 2 \/ 36, 1 \/ 36],     '  4: [1 \/ 1296, 4 \/ 1296, 10 \/ 1296, 20 \/ 1296, 35 \/ 1296, 56 \/ 1296, 80 \/ 1296, 104 \/ 1296, 125 \/ 1296, 140 \/ 1296, 146 \/ 1296, 140 \/ 1296, 125 \/ 1296, 104 \/ 1296, 80 \/ 1296, 56 \/ 1296, 35 \/ 1296, 20 \/ 1296, 10 \/ 1296, 4 \/ 1296, 1 \/ 1296]     '  5: [1 \/ 7776, 5 \/ 7776, 15 \/ 7776, 35 \/ 7776, 70 \/ 7776, 126 \/ 7776, 205 \/ 7776, 305 \/ 7776, 420 \/ 7776, 540 \/ 7776, 651 \/ 7776, 735 \/ 7776, 780 \/ 7776, 780 \/ 7776, 735 \/ 7776, 651 \/ 7776, 540 \/ 7776, 420 \/ 7776, 305 \/ 7776, 205 \/ 7776, 126 \/ 7776, 70 \/ 7776, 35 \/ 7776, 15 \/ 7776, 5 \/ 7776, 1 \/ 7776]     '}     Dim j     Dim list_probability()     ReDim list_probability(int_side_dice - 1)     For j = 0 To int_side_dice - 1         list_probability(j) = 1 \/ int_side_dice     Next     Dim dict_interm_probability     Set dict_interm_probability = CreateObject(\"Scripting.Dictionary\")     dict_interm_probability.Add 1, list_probability      If int_pow = 0 Then         MsgBox \"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\"         Quit     ElseIf int_pow &lt;> 1 Then         Dim list_to_do()         map_todo list_to_do, int_pow         For j = 0 To UBound(list_to_do, 2)             'MsgBox list_to_do(0, j) &amp; vbTab &amp; list_to_do(1, j) &amp; vbTab &amp; list_to_do(2, j)             multiply_cins_orig _                 dict_interm_probability.Item(list_to_do(0, j)), _                 dict_interm_probability.Item(list_to_do(1, j)), _                 list_out             dict_interm_probability.Add list_to_do(2, j), list_out             ' ArrOut_1 list_out         Next     End If End Sub   '\u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 Sub map_todo(list_solution, int_wanted)     '\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     '\u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     '1     '1 * 2 = 2 -> Array(1, 1, 2)     '2 * 2 = 4 -> Array(2, 2, 4)     '4 + 1 = 5 -> Array(4, 1, 5)      Dim int_current_id     Dim int_sum     Dim b_ascending     Dim i          int_current_id = 1     int_sum = 1     b_ascending = True     i = -1      Do         If b_ascending And 2 * int_current_id &lt;= int_wanted Then             i = i + 1             ReDim Preserve list_solution(2, i)             list_solution(0, i) = int_current_id             list_solution(1, i) = int_current_id             list_solution(2, i) = 2 * int_current_id             int_current_id = 2 * int_current_id             int_sum = int_current_id         ElseIf b_ascending And 2 * int_current_id > int_wanted Then             b_ascending = False             int_sum = int_current_id             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         ElseIf Not b_ascending And int_sum + int_current_id &lt;= int_wanted Then             i = i + 1             ReDim Preserve list_solution(2, i)             list_solution(0, i) = int_sum             list_solution(1, i) = int_current_id             list_solution(2, i) = int_sum + int_current_id             int_sum = int_sum + int_current_id             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         ElseIf Not b_ascending And int_sum + int_current_id > int_wanted Then             int_current_id = CInt(int_current_id \/ 2)  '\u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         End If     Loop Until (int_sum = int_wanted) End Sub   ' \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 Sub multiply_cins_orig(list_in_1, list_in_2, list_in)     Dim int_len_1     Dim int_len_2     int_len_1 = Ubound(list_in_1, 1)     int_len_2 = Ubound(list_in_2, 1)      Dim list_for_sum()     ReDim list_for_sum(int_len_2, int_len_1 + int_len_2)     Dim i, j, k, n     For i = 0 To int_len_2         j = 0         For n = 0 To int_len_2             If i = n Then                 For k = 0 To int_len_1                     list_for_sum(i, j) = list_in_1(k) * list_in_2(n)                     j = j + 1                 Next             Else                 list_for_sum(i, j) = 0                 j = j + 1             End If         Next     Next     '[list_in_1 X list_in_2[0], 0, 0, 0, 0, 0]     '[0, list_in_1 X list_in_2[1], 0, 0, 0, 0]     '[0, 0, list_in_1 X list_in_2[2], 0, 0, 0]     '[0, 0, 0, list_in_1 X list_in_2[3], 0, 0]     '[0, 0, 0, 0, list_in_1 X list_in_2[4], 0]     '[0, 0, 0, 0, 0, list_in_1 X list_in_2[5]]      'ArrOut_2 list_for_sum     Erase list_in     ReDim list_in(int_len_1 + int_len_2)     Dim sum_out     For j = 0 To int_len_1 + int_len_2         sum_out = 0         For i = 0 To int_len_2             sum_out = sum_out + list_for_sum(i, j)         Next         list_in(j) = sum_out     Next     ' [1 \/ 216, 3 \/ 216, 6 \/ 216, 10 \/ 216, 15 \/ 216, 21 \/ 216, 25 \/ 216, 27 \/ 216, 27 \/ 216, 25 \/ 216, 21 \/ 216, 15 \/ 216, 10 \/ 216, 6 \/ 216, 3 \/ 216, 1 \/ 216]     'ArrOut_1 list_in End Sub   '================================================== '&lt;Additional_MsgBox_For_Arrays> Sub ArrOut_1(arr_in)     Dim str_out     Dim i     For i = 0 To UBound(arr_in)         If i = 0 Then             str_out = arr_in(i)         Else             str_out = str_out &amp; \" \" &amp; arr_in(i)         End If     Next     MsgBox str_out End Sub  Sub ArrOut_2(arr_in)     Dim str_out     Dim i, j     For i = 0 To UBound(arr_in, 1)         For j = 0 To UBound(arr_in, 2)             If i = 0 And j = 0 Then                 str_out = arr_in(i, j)             ElseIf j = 0 Then                 str_out = str_out &amp; vbNewLine &amp; arr_in(i, j)             Else                 str_out = str_out &amp; \" \" &amp; arr_in(i, j)             End If         Next     Next     MsgBox str_out End Sub '&lt;\/Additional_MsgBox_For_Arrays> '==================================================  main<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435<\/h2>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0447\u044c\u0438\u0445 \u0431\u044b \u0442\u043e \u043d\u0438 \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e (\u0442.\u0435. \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u201c\u0432 \u043b\u043e\u0431\u201d) \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u0438\u043d\u044b\u043c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u0430\u0432\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u0441\u043e\u0447\u0435\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f \u0442\u0430\u043a \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0412\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/676854\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0442\u043e\u0433\u0434\u0430 \u043c\u043e\u0433\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441\u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0445 \u0432 \u043b\u043e\u0431 \u043a\u0443\u0431\u0438\u043a\u0438, \u0441\u0443\u043c\u043c\u044b \u0438\u0445 \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0438 \u0438\u0445 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>Python \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432 \u043b\u043e\u0431<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import sqlite3 import re  def main() -> None:     c_int_side_dice: int = 6  # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     c_int_dice_number: int = 6  # \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432      str_query = select_values_and_interm_probabilities(c_int_side_dice, c_int_dice_number)     if True:         # \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 SQL \u043a\u043e\u0434\u0430         print(str_query)     else:         # \u041f\u0440\u043e\u0433\u043e\u043d SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430         conn = sqlite3.connect(\":memory:\")         cursor = conn.cursor()          cursor.execute(str_query)         return_select(cursor)          cursor.close()         conn.close()   def select_values_and_interm_probabilities(int_side_dice: int, int_dice_number: int) -> str:     str_sub_query_1: str = \"\"\"     -- \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u043a\u0443\u0431\u0438\u043a\u0430     WITH RECURSIVE step_01_insert (dice) AS (         SELECT 1 AS dice         UNION ALL         SELECT dice + 1 AS dice          FROM step_01_insert         WHERE dice &lt; {}  -- \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     )     \"\"\".format(int_side_dice)     list_sub_query_1: list[str] = []     list_sub_query_2: list[str] = []     list_sub_query_3: list[str] = []     for i in range(int_dice_number):         list_sub_query_1.append(\"T{}.dice AS dice_{}\".format(i, i))         list_sub_query_2.append(\"T{}.dice\".format(i))         list_sub_query_3.append(\"step_01_insert AS T{}\".format(i))      str_sub_query_2: str = \"\\n\".join([         \"-- \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f {}-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432\".format(int_dice_number),         \", step_02_spawn AS (\",             \"SELECT\",             \"\\n, \".join(list_sub_query_1),             \", \" + \" + \".join(list_sub_query_2) + \" AS dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)\",             \"FROM\",             \"\\n, \".join(list_sub_query_3),         \")\"     ])     del list_sub_query_1, list_sub_query_2, list_sub_query_3      str_sub_query_3: str = \"\"\"     -- \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432 \u043b\u043e\u0431, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     , step_03_dividend (dice_sum, dividend) AS (         SELECT dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)         , COUNT(1) AS dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435         FROM step_02_spawn         GROUP BY dice_sum     )     , step_04_divisor(divisor) AS (         SELECT SUM(dividend) AS divisor         FROM step_03_dividend     )     SELECT T1.dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     , T1.dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     , CAST(T1.dividend AS REAL) \/ CAST(T2.divisor AS REAL) AS probability  -- \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c     FROM step_03_dividend AS T1     , step_04_divisor AS T2     ORDER BY T1.dice_sum;     \"\"\"     return lazy_prety_print(str_sub_query_1 + str_sub_query_2 + str_sub_query_3)   def lazy_prety_print(str_in: str) -> str:     list_line: list[str] = []     str_offset: str = \"\"     for str_line_1 in str_in.split(\"\\n\"):         str_line_2 = re.sub(r\"^\\s+\", \"\", str_line_1)         if len(str_line_2) > 0 and str_line_2[0] == \")\":             str_offset = str_offset[:-4]         list_line.append(str_offset + str_line_2)         if len(str_line_2) > 0 and str_line_2[-1] == \"(\":             str_offset = str_offset + \"    \"     return \"\\n\".join(list_line)   def return_select(cursor: sqlite3.Cursor) -> None:     column_list = []      for column in cursor.description:         column_list.append(column[0])      print(\"\\t\".join(column_list))      rows = cursor.fetchall()      for row in rows:         column_list = []         for row_column in row:             column_list.append(str(row_column))         print(\"\\t\".join(column_list))   if __name__ == \"__main__\":     main() <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0438\u0436\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>SQL \u0434\u043b\u044f 3-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">-- \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u043a\u0443\u0431\u0438\u043a\u0430 WITH RECURSIVE step_01_insert (dice) AS (     SELECT 1 AS dice     UNION ALL     SELECT dice + 1 AS dice      FROM step_01_insert     WHERE dice &lt; 6  -- \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430 ) -- \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f 3-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432 , step_02_spawn AS (     SELECT     T0.dice AS dice_0     , T1.dice AS dice_1     , T2.dice AS dice_2     , T0.dice + T1.dice + T2.dice AS dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     FROM     step_01_insert AS T0     , step_01_insert AS T1     , step_01_insert AS T2 ) -- \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432 \u043b\u043e\u0431, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , step_03_dividend (dice_sum, dividend) AS (     SELECT dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     , COUNT(1) AS dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     FROM step_02_spawn     GROUP BY dice_sum ) , step_04_divisor(divisor) AS (     SELECT SUM(dividend) AS divisor     FROM step_03_dividend ) SELECT T1.dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) , T1.dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , CAST(T1.dividend AS REAL) \/ CAST(T2.divisor AS REAL) AS probability  -- \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c FROM step_03_dividend AS T1 , step_04_divisor AS T2 ORDER BY T1.dice_sum;<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">dice_sum<\/p>\n<\/td>\n<td>\n<p align=\"left\">dividend<\/p>\n<\/td>\n<td>\n<p align=\"left\">probability<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.004629629629629629<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.013888888888888888<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.027777777777777776<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.046296296296296294<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06944444444444445<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09722222222222222<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">25<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.11574074074074074<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">27<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.125<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">11<\/p>\n<\/td>\n<td>\n<p align=\"left\">27<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.125<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">12<\/p>\n<\/td>\n<td>\n<p align=\"left\">25<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.11574074074074074<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09722222222222222<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">14<\/p>\n<\/td>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06944444444444445<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.046296296296296294<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.027777777777777776<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">17<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.013888888888888888<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">18<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.004629629629629629<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>SQL \u0434\u043b\u044f 4-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">-- \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u043a\u0443\u0431\u0438\u043a\u0430 WITH RECURSIVE step_01_insert (dice) AS (     SELECT 1 AS dice     UNION ALL     SELECT dice + 1 AS dice      FROM step_01_insert     WHERE dice &lt; 6  -- \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430 ) -- \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f 4-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432 , step_02_spawn AS (     SELECT     T0.dice AS dice_0     , T1.dice AS dice_1     , T2.dice AS dice_2     , T3.dice AS dice_3     , T0.dice + T1.dice + T2.dice + T3.dice AS dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     FROM     step_01_insert AS T0     , step_01_insert AS T1     , step_01_insert AS T2     , step_01_insert AS T3 ) -- \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432 \u043b\u043e\u0431, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , step_03_dividend (dice_sum, dividend) AS (     SELECT dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     , COUNT(1) AS dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     FROM step_02_spawn     GROUP BY dice_sum ) , step_04_divisor(divisor) AS (     SELECT SUM(dividend) AS divisor     FROM step_03_dividend ) SELECT T1.dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) , T1.dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , CAST(T1.dividend AS REAL) \/ CAST(T2.divisor AS REAL) AS probability  -- \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c FROM step_03_dividend AS T1 , step_04_divisor AS T2 ORDER BY T1.dice_sum;<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">dice_sum<\/p>\n<\/td>\n<td>\n<p align=\"left\">dividend<\/p>\n<\/td>\n<td>\n<p align=\"left\">probability<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0007716049382716049<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0030864197530864196<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.007716049382716049<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.015432098765432098<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">35<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.02700617283950617<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">56<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.043209876543209874<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">80<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06172839506172839<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">11<\/p>\n<\/td>\n<td>\n<p align=\"left\">104<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08024691358024691<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">12<\/p>\n<\/td>\n<td>\n<p align=\"left\">125<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09645061728395062<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">140<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.10802469135802469<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">14<\/p>\n<\/td>\n<td>\n<p align=\"left\">146<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.11265432098765432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">140<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.10802469135802469<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">125<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09645061728395062<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">17<\/p>\n<\/td>\n<td>\n<p align=\"left\">104<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08024691358024691<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">18<\/p>\n<\/td>\n<td>\n<p align=\"left\">80<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06172839506172839<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">19<\/p>\n<\/td>\n<td>\n<p align=\"left\">56<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.043209876543209874<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">35<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.02700617283950617<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.015432098765432098<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">22<\/p>\n<\/td>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.007716049382716049<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">23<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0030864197530864196<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">24<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0007716049382716049<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>SQL \u0434\u043b\u044f 5-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">-- \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u043a\u0443\u0431\u0438\u043a\u0430 WITH RECURSIVE step_01_insert (dice) AS (     SELECT 1 AS dice     UNION ALL     SELECT dice + 1 AS dice      FROM step_01_insert     WHERE dice &lt; 6  -- \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430 ) -- \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f 5-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432 , step_02_spawn AS (     SELECT     T0.dice AS dice_0     , T1.dice AS dice_1     , T2.dice AS dice_2     , T3.dice AS dice_3     , T4.dice AS dice_4     , T0.dice + T1.dice + T2.dice + T3.dice + T4.dice AS dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     FROM     step_01_insert AS T0     , step_01_insert AS T1     , step_01_insert AS T2     , step_01_insert AS T3     , step_01_insert AS T4 ) -- \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432 \u043b\u043e\u0431, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , step_03_dividend (dice_sum, dividend) AS (     SELECT dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     , COUNT(1) AS dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     FROM step_02_spawn     GROUP BY dice_sum ) , step_04_divisor(divisor) AS (     SELECT SUM(dividend) AS divisor     FROM step_03_dividend ) SELECT T1.dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) , T1.dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , CAST(T1.dividend AS REAL) \/ CAST(T2.divisor AS REAL) AS probability  -- \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c FROM step_03_dividend AS T1 , step_04_divisor AS T2 ORDER BY T1.dice_sum;<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">dice_sum<\/p>\n<\/td>\n<td>\n<p align=\"left\">dividend<\/p>\n<\/td>\n<td>\n<p align=\"left\">probability<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0001286008230452675<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0006430041152263374<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0019290123456790122<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">35<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0045010288065843625<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">70<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.009002057613168725<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">126<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.016203703703703703<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">11<\/p>\n<\/td>\n<td>\n<p align=\"left\">205<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.026363168724279837<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">12<\/p>\n<\/td>\n<td>\n<p align=\"left\">305<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03922325102880658<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">420<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.05401234567901234<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">14<\/p>\n<\/td>\n<td>\n<p align=\"left\">540<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06944444444444445<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">651<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08371913580246913<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">735<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09452160493827161<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">17<\/p>\n<\/td>\n<td>\n<p align=\"left\">780<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.10030864197530864<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">18<\/p>\n<\/td>\n<td>\n<p align=\"left\">780<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.10030864197530864<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">19<\/p>\n<\/td>\n<td>\n<p align=\"left\">735<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09452160493827161<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">651<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08371913580246913<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">540<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.06944444444444445<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">22<\/p>\n<\/td>\n<td>\n<p align=\"left\">420<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.05401234567901234<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">23<\/p>\n<\/td>\n<td>\n<p align=\"left\">305<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03922325102880658<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">24<\/p>\n<\/td>\n<td>\n<p align=\"left\">205<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.026363168724279837<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">25<\/p>\n<\/td>\n<td>\n<p align=\"left\">126<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.016203703703703703<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">26<\/p>\n<\/td>\n<td>\n<p align=\"left\">70<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.009002057613168725<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">27<\/p>\n<\/td>\n<td>\n<p align=\"left\">35<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0045010288065843625<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">28<\/p>\n<\/td>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0019290123456790122<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">29<\/p>\n<\/td>\n<td>\n<p align=\"left\">5<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0006430041152263374<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">30<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0001286008230452675<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>SQL \u0434\u043b\u044f 6-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">-- \u0437\u0430\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d \u043a\u0443\u0431\u0438\u043a\u0430 WITH RECURSIVE step_01_insert (dice) AS (     SELECT 1 AS dice     UNION ALL     SELECT dice + 1 AS dice      FROM step_01_insert     WHERE dice &lt; 6  -- \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430 ) -- \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0434\u043b\u044f 6-\u0445 \u043a\u0443\u0431\u0438\u043a\u043e\u0432 , step_02_spawn AS (     SELECT     T0.dice AS dice_0     , T1.dice AS dice_1     , T2.dice AS dice_2     , T3.dice AS dice_3     , T4.dice AS dice_4     , T5.dice AS dice_5     , T0.dice + T1.dice + T2.dice + T3.dice + T4.dice + T5.dice AS dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     FROM     step_01_insert AS T0     , step_01_insert AS T1     , step_01_insert AS T2     , step_01_insert AS T3     , step_01_insert AS T4     , step_01_insert AS T5 ) -- \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432 \u043b\u043e\u0431, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , step_03_dividend (dice_sum, dividend) AS (     SELECT dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439)     , COUNT(1) AS dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     FROM step_02_spawn     GROUP BY dice_sum ) , step_04_divisor(divisor) AS (     SELECT SUM(dividend) AS divisor     FROM step_03_dividend ) SELECT T1.dice_sum  -- \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) , T1.dividend  -- \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 , CAST(T1.dividend AS REAL) \/ CAST(T2.divisor AS REAL) AS probability  -- \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c FROM step_03_dividend AS T1 , step_04_divisor AS T2 ORDER BY T1.dice_sum;<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">dice_sum<\/p>\n<\/td>\n<td>\n<p align=\"left\">dividend<\/p>\n<\/td>\n<td>\n<p align=\"left\">probability<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2.143347050754458e-05<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0001286008230452675<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0004501028806584362<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<td>\n<p align=\"left\">56<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0012002743484224967<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">10<\/p>\n<\/td>\n<td>\n<p align=\"left\">126<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.002700617283950617<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">11<\/p>\n<\/td>\n<td>\n<p align=\"left\">252<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.005401234567901234<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">12<\/p>\n<\/td>\n<td>\n<p align=\"left\">456<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.00977366255144033<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">756<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.016203703703703703<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">14<\/p>\n<\/td>\n<td>\n<p align=\"left\">1161<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.02488425925925926<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">15<\/p>\n<\/td>\n<td>\n<p align=\"left\">1666<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03570816186556927<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<td>\n<p align=\"left\">2247<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.048161008230452676<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">17<\/p>\n<\/td>\n<td>\n<p align=\"left\">2856<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.061213991769547324<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">18<\/p>\n<\/td>\n<td>\n<p align=\"left\">3431<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.07353823731138547<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">19<\/p>\n<\/td>\n<td>\n<p align=\"left\">3906<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08371913580246913<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">4221<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09047067901234568<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">4332<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09284979423868313<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">22<\/p>\n<\/td>\n<td>\n<p align=\"left\">4221<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.09047067901234568<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">23<\/p>\n<\/td>\n<td>\n<p align=\"left\">3906<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.08371913580246913<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">24<\/p>\n<\/td>\n<td>\n<p align=\"left\">3431<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.07353823731138547<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">25<\/p>\n<\/td>\n<td>\n<p align=\"left\">2856<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.061213991769547324<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">26<\/p>\n<\/td>\n<td>\n<p align=\"left\">2247<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.048161008230452676<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">27<\/p>\n<\/td>\n<td>\n<p align=\"left\">1666<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.03570816186556927<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">28<\/p>\n<\/td>\n<td>\n<p align=\"left\">1161<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.02488425925925926<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">29<\/p>\n<\/td>\n<td>\n<p align=\"left\">756<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.016203703703703703<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">30<\/p>\n<\/td>\n<td>\n<p align=\"left\">456<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.00977366255144033<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">31<\/p>\n<\/td>\n<td>\n<p align=\"left\">252<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.005401234567901234<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">126<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.002700617283950617<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">33<\/p>\n<\/td>\n<td>\n<p align=\"left\">56<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0012002743484224967<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">34<\/p>\n<\/td>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0004501028806584362<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">35<\/p>\n<\/td>\n<td>\n<p align=\"left\">6<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0001286008230452675<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">36<\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">2.143347050754458e-05<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/details>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c:<br \/>&#8212; \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439<br \/>&#8212; \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u0443\u0431\u0438\u043a\u043e\u0432<br \/>&#8212; \u043a\u0430\u043a \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 k, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0443\u043c\u043c\u044b \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u0434\u043b\u044f 1000 \u043a\u0443\u0431\u0438\u043a\u043e\u0432.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/post\/685552\/\"> https:\/\/habr.com\/ru\/post\/685552\/<\/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 article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/676854\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0443\u043c\u043c\u044b \u0447\u0438\u0441\u0435\u043b \u043d\u0430 \u043a\u0443\u0431\u0438\u043a\u0430\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B2%D1%91%D1%80%D1%82%D0%BA%D0%B0_%D0%BF%D0%BE%D1%81%D0%BB%D0%B5%D0%B4%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%D1%81%D1%82%D0%B5%D0%B9\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/a> [1 1 1 1 1 1] \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a (\u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432) \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438\/\u0447\u0438\u0441\u043b\u0430 111111 \u043d\u0430 \u0441\u0430\u043c\u0443\/\u0441\u0430\u043c\u043e \u0441\u0435\u0431\u044f. \u041f\u043e\u0447\u0435\u043c\u0443, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u0435 \u043f\u0438\u0448\u0443\u0442, \u0447\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0435\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0437\u0430\u0433\u0430\u0434\u043a\u0430 (\u043c\u043e\u0436\u0435\u0442 \u044f \u0447\u0442\u043e-\u0442\u043e \u0443\u043f\u0443\u0441\u043a\u0430\u044e \u0438\u0437 \u0432\u0438\u0434\u0430 &#8212; \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u043f\u0440\u0430\u0432, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435). \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0432\u0430 \u0441\u043b\u043e\u0432\u043e\u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044f &#171;\u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439&#187; \u0438 &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e, \u0442.\u043a. \u043f\u0435\u0440\u0432\u043e\u0435 \u2014 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f &#171;\u0441\u0442\u0440\u0430\u0448\u0438\u043b\u0441\u044f&#187; \u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f 1000 \u043a\u0443\u0431\u0438\u043a\u043e\u0432. \u0412\u043e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438\u043c \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<h2>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f<\/h2>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0432\u0432\u0435\u0440\u0445\u0443, \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/676854\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0443\u043f\u043e\u0440 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u043d\u0430 &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \/ \u0441\u0432\u0451\u0440\u0442\u043a\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 [1 1 1 1 1 1], \u0438 \u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c &#171;\u0443\u043c\u043d\u043e\u0436\u0438\u0442\u044c&#187; \u043d\u0430 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0435\u0449\u0451. \u0412\u043e\u0442 \u044d\u0442\u0443 \u043e\u043f\u043b\u043e\u0448\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u043f\u0440\u0430\u0437\u0434\u043d\u0438\u0442\u044c.<\/p>\n<p>\u041e\u0442\u0432\u043b\u0435\u043a\u0443\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0430 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0447\u0438\u0441\u043b\u0430 2 (<a href=\"https:\/\/habr.com\/ru\/post\/204258\/\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u0442\u0443\u0434\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/a> \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441: <em>\u043a\u0430\u043a\u0438\u0435 \u0433\u0440\u0443\u0437\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0432\u0435\u0441\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0438\u0440\u044c \u0432 2<sup>0<\/sup>, 2<sup>1<\/sup>, 2<sup>2<\/sup>,&#8230;, 2<sup>n<\/sup> \u0433\u0440\u0430\u043c\u043c \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c?<\/em>). \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0447\u0438\u0441\u043b\u0430 a<sup>63<\/sup> \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a: a<sup>63<\/sup> = a<sup>1 + 2 + 4 + \u2026 + 32<\/sup> = a<sup>1<\/sup> * a<sup>2<\/sup> * a<sup>4<\/sup> * \u2026 * a<sup>32<\/sup>. \u0422\u043e \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e I \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u0443\u043c\u0435\u044f \u0443\u043c\u043d\u043e\u0436\u0430\u0442\u044c\/\u0441\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 63-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u0441\u0442\u0435\u043f\u0435\u043d\u044c 63) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\/\u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0431\u043a\u0430\u0442\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; \u043d\u0430 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u041f\u0430\u0441\u043a\u0430\u043b\u044f. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0439\u0442\u0438 9-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0437\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e I \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u0438\u043c\u0435\u043d\u043d\u043e [1 1]) \u043d\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187; [1 1] \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0435\u0431\u044f (<a href=\"https:\/\/qastack.ru\/codegolf\/80030\/discrete-convolution-or-polynomial-multiplication\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435<\/a>), \u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0441\u0435\u043b \u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 [1 1]. \u0417\u0432\u0443\u0447\u0438\u0442 \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 9-\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435. \u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<details class=\"spoiler\">\n<summary>Python. \u041f\u0440\u0438\u043c\u0435\u0440. II, IV, VIII, XI \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u041f\u0430\u0441\u043a\u0430\u043b\u044f<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import numpy  convolve_out = numpy.convolve([1, 1], [1, 1]) # [1 2 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [1 4 6 4 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [ 1 8 28 56 70 56 28 8 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, [1, 1]) # [ 1 9 36 84 126 126 84 36 9 1] print(convolve_out) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, I \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h2>\n<p>\u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u041f\u0430\u0441\u043a\u0430\u043b\u044f \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0441 \u043a\u0443\u0431\u0438\u043a\u0430\u043c\u0438, \u0438 \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0443\u043c\u043c\u044b \u043a\u043e\u0441\u0442\u0435\u0439 19 \u0434\u043b\u044f 5 \u043a\u0443\u0431\u0438\u043a\u043e\u0432. \u0422.\u0435. \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c [1 1 1 1 1 1] \u0438 \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e 5-\u043e\u0433\u043e \u043a\u0443\u0431\u0438\u043a\u0430 (\u0441\u0442\u0435\u043f\u0435\u043d\u044c 5) \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ &#171;\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a&#187;:<\/p>\n<p> a<sup>1<\/sup> * a<sup>1<\/sup> = a<sup>2<\/sup><\/p>\n<p> a<sup>2<\/sup> * a<sup>2<\/sup> = a<sup>4<\/sup><\/p>\n<p> a<sup>1<\/sup> * a<sup>4<\/sup> = a<sup>5<\/sup><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u201c\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u201d \u0432 \u201c\u042d\u0442\u0430\u043f I. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f 2-\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432\/\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432: \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0441\u0443\u043c\u043c\u0430 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043a\u043e\u0441\u0442\u0435\u0439) \u0418 \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u201d \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u0451\u0440\u0442\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \/ \u201c\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u201d.<\/p>\n<details class=\"spoiler\">\n<summary>Python. \u041f\u0440\u0438\u043c\u0435\u0440. \u0421\u0432\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 [1 1 1 1 1 1]<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  import numpy  convolve_out = numpy.convolve([1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]) # [1 2 3 4 5 6 5 4 3 2 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, convolve_out) # [ 1 4 10 20 35 56 80 104 125 140 146 140 125 104 80 56 35 20 10 4 1] print(convolve_out)  convolve_out = numpy.convolve(convolve_out, [1, 1, 1, 1, 1, 1]) # [ 1 5 15 35 70 126 205 305 420 540 651 735 780 780 735 651 540 420 305 205 126 70 35 15 5 1] print(convolve_out) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u043a\u0440\u0438\u043f\u0442\u044b, I \u043f\u043e\u043f\u044b\u0442\u043a\u0430<\/h2>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0437\u0430\u0434\u0443\u043c\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0430. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043b\u0435\u043a\u0430\u043b\u0430\u043c. \u041f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>Python<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"># -*- coding: utf-8 -*-  def main():     c_int_side_dice: int = 6  # \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     c_int_dice_number: int = 1000  # \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     c_int_number_to_find: int = 2000  # \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice)     print(probability)   # \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f def dice_probability(int_dice_number: int, int_number_to_find: int, c_int_side_dice: int) -> float:     if int_number_to_find >= int_dice_number and int_number_to_find &lt;= c_int_side_dice * int_dice_number:         list_values: list[int] = [i for i in range(int_dice_number, c_int_side_dice * int_dice_number + 1)]         list_interm_probability = interm_probabilities(c_int_side_dice, int_dice_number)          for i in range(len(list_values)):             if list_values[i] == int_number_to_find:                 int_out: int = list_interm_probability[i]                 break         return int_out \/ (c_int_side_dice ** int_dice_number)     else:         # \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439         return 0.0   # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a\/\u043c\u0430\u0441\u0441\u0438\u0432: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 def interm_probabilities(int_side_dice: int, int_pow: int) -> list[int]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_side_dice = 6, int_pow = 5     {       1: [1, 1, 1, 1, 1, 1],       2: [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1],       4: [1, 4, 10, 20, 35, 56, 80, 104, 125, 140, 146, 140, 125, 104, 80, 56, 35, 20, 10, 4, 1]       5: [1, 5, 15, 35, 70, 126, 205, 305, 420, 540, 651, 735, 780, 780, 735, 651, 540, 420, 305, 205, 126, 70, 35, 15, 5, 1]     }     \"\"\"     dict_interm_probability: dict[int, list[int]] = {1: [1] * int_side_dice}     if int_pow == 0:         print(\"\u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\")         quit()     elif int_pow != 1:         list_to_do = map_todo(int_pow)          for elem in list_to_do:             dict_interm_probability[elem[2]] = multiply_cins_orig(dict_interm_probability[elem[0]], dict_interm_probability[elem[1]])     return dict_interm_probability[int_pow]   # \u041a\u0430\u043a \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f x2\/+nx \u0434\u043b\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 def map_todo(int_wanted: int) -> list[tuple[int, int, int]]:     \"\"\"     \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 int_wanted = 5     \u0421\u0442\u0435\u043f\u0435\u043d\u0438 \"\u0447\u0438\u0441\u043b\u0430\":     1     1 * 2 = 2 -> tuple(1, 1, 2)     2 * 2 = 4 -> tuple(2, 2, 4)     4 + 1 = 5 -> tuple(4, 1, 5)     \"\"\"      int_current_id: int = 1     int_sum: int = 1     b_ascending: bool = True     list_solution: list[tuple[int, int, int]] = []      while True:         if int_sum == int_wanted:             break         elif b_ascending and 2 * int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_current_id, int_current_id, 2 * int_current_id)             )             int_current_id = 2 * int_current_id             int_sum = int_current_id         elif b_ascending and 2 * int_current_id > int_wanted:             b_ascending = False             int_sum = int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id &lt;= int_wanted:             list_solution.append(  # mult_1, mult_2, result                 (int_sum, int_current_id, int_sum + int_current_id)             )             int_sum = int_sum + int_current_id             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer         elif not b_ascending and int_sum + int_current_id > int_wanted:             int_current_id = int(int_current_id \/ 2)  # \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e integer     return list_solution   # \"\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\" \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432\/\u0441\u043f\u0438\u0441\u043a\u043e\u0432 def multiply_cins_orig(list_in_1: list[int], list_in_2: list[int]) -> list[int]:     int_len_2: int = len(list_in_2)     list_dummy: list[list[int]] = []     for i in range(int_len_2):         list_dummy.append([0] * i)  # [], [0], [0, 0], [0, 0, 0] ...      list_for_sum: list[list[int]] = []     i: int = -1     for elem_2 in list_in_2:         i += 1         list_interm: list[int] = [elem_1 * elem_2 for elem_1 in list_in_1]         list_for_sum.append(list_dummy[i] + list_interm + list_dummy[int_len_2 - i - 1])      \"\"\"     [list_in_1 X elem_2[0], 0, 0, 0, 0, 0]     [0, list_in_1 X elem_2[1], 0, 0, 0, 0]     [0, 0, list_in_1 X elem_2[2], 0, 0, 0]     [0, 0, 0, list_in_1 X elem_2[3], 0, 0]     [0, 0, 0, 0, list_in_1 X elem_2[4], 0]     [0, 0, 0, 0, 0, list_in_1 X elem_2[5]]     \"\"\"      list_out: list[int] = []     for i in range(len(list_for_sum[0])):         sum_out: int = 0         for j in range(int_len_2):             sum_out += list_for_sum[j][i]         list_out.append(sum_out)     \"\"\"     [1, 3, 6, 10, 15, 21, 25, 27, 27, 25, 21, 15, 10, 6, 3, 1]     \"\"\"     return list_out   main() <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>JavaScript<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"javascript\">function main(){     const c_int_side_dice = 6;  \/\/ \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0430\u043d\u0435\u0439 \u0443 \u043a\u0443\u0431\u0438\u043a\u0430     const c_int_dice_number = 100; \/\/ \u043a\u043e\u043b-\u0432\u043e \u043a\u0443\u0431\u0438\u043a\u043e\u0432     const c_int_number_to_find = 300; \/\/ \u0447\u0438\u0441\u043b\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438     let probability = dice_probability(c_int_dice_number, c_int_number_to_find, c_int_side_dice);     console.log(probability); }   \/\/ \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f function dice_probability(int_dice_number, int_number_to_find, c_int_side_dice){     if (int_number_to_find >= int_dice_number &amp;&amp; int_number_to_find &lt;= c_int_side_dice * int_dice_number){         let list_values = new Array();         let i = 0;         for (let j = int_dice_number; j &lt;= c_int_side_dice * int_dice_number; j++){             list_values[i] = j;             i++;       <\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-337740","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337740","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=337740"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337740\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}