{"id":286558,"date":"2017-05-18T18:00:08","date_gmt":"2017-05-18T14:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=286558"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=286558","title":{"rendered":"\u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u041c\u0435\u043d\u0434\u0435\u043b\u0435\u0435\u0432\u0430"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/0ce\/932\/5a9\/0ce9325a99ff4b5782697b2a737fd6b9.jpg\"\/><\/p>\n<p>  <\/p>\n<p><em>(\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/mesbahamin\/stoichiograph\">\u0442\u0443\u0442<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u0434\u044f \u043d\u0430 \u043f\u044f\u0442\u0438\u0447\u0430\u0441\u043e\u0432\u043e\u043c \u0437\u0430\u043d\u044f\u0442\u0438\u0438 \u043f\u043e \u0445\u0438\u043c\u0438\u0438, \u044f \u0447\u0430\u0441\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u0437\u0438\u043b \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u041c\u0435\u043d\u0434\u0435\u043b\u0435\u0435\u0432\u0430, \u0432\u0438\u0441\u044f\u0449\u0435\u0439 \u043d\u0430 \u0441\u0442\u0435\u043d\u0435. \u0427\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u0440\u043e\u0442\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433 \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u0438\u0448\u044c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: ScAlEs, FeArS, ErAsURe, WAsTe, PoInTlEsSnEsS, MoISTeN, SAlMoN, PuFFInEsS.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a\u043e\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c (\u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c <a href=\"https:\/\/www.poets.org\/poetsorg\/poem\/bells\">TiNTiNNaBULaTiONS<\/a>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 Python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043a\u0430\u043b\u0430 \u0431\u044b \u0441\u043b\u043e\u0432\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0430\u0431\u043e\u0440\u044b \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u0445\u043e\u0434:<br \/> \n<ul>\n<li>Amputations<\/li>\n<\/ul>\n<\/li>\n<li>\u0412\u044b\u0445\u043e\u0434:<br \/> \n<ul>\n<li>AmPuTaTiONS, AmPUTaTiONS<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"generirovanie-gruppirovok-oboznacheniy\">\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043e\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u044b\u043b\u0438 \u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0431\u044b \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439. \u041d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u2014 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e. \u042d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0434\u0435\u043b\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, pu \u0432 Amputations \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043b\u0443\u0442\u043e\u043d\u0438\u0439 (Pu) \u0438\u043b\u0438 \u0444\u043e\u0441\u0444\u043e\u0440 \u0441 \u0443\u0440\u0430\u043d\u043e\u043c (PU). \u041b\u044e\u0431\u043e\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e- \u0438 \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u00ab\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438\u00bb. \u041e\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 \u043d\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446 \u0438 \u0434\u0432\u043e\u0435\u043a, \u0433\u0434\u0435 1 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0434\u043d\u043e\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0430 2 \u2014 \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0435. \u041a\u0430\u0436\u0434\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>&#8216;AmPuTaTiONS&#8217;<br \/> \n<ul>\n<li><code>(2,2,2,2,1,1,1)<\/code><\/li>\n<\/ul>\n<\/li>\n<li>&#8216;AmPUTaTiONS&#8217;<br \/> \n<ul>\n<li><code>(2,1,1,2,2,1,1,1)<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u0437\u0430\u0434\u0430\u0447\u0443, \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432 \u0442\u0435\u0442\u0440\u0430\u0434\u0438 \u0442\u0430\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<p>  <\/p>\n<p><strong>\u0412\u043e\u043f\u0440\u043e\u0441:<\/strong> \u0434\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 n, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u0435\u0451 \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0435\u0434\u0438\u043d\u0438\u0446 \u0438 \u0434\u0432\u043e\u0435\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0432\u043d\u044f\u043b\u043e\u0441\u044c n?<\/p>\n<p>  <\/p>\n<table>\n<thead>\n<tr>\n<th>n<\/th>\n<th># \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043e\u043a<\/th>\n<th>\u0413\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0<\/td>\n<td>1<\/td>\n<td><code>()<\/code><\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>1<\/td>\n<td><code>(1)<\/code><\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>2<\/td>\n<td><code>(1,1), (2)<\/code><\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>3<\/td>\n<td><code>(1,1,1), (2,1), (1,2)<\/code><\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>5<\/td>\n<td><code>(1,1,1,1), (2,1,1), (1,2,1), (1,1,2), (2,2)<\/code><\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>8<\/td>\n<td><code>(1,1,1,1,1), (2,1,1,1), (1,2,1,1), (1,1,2,1), (1,1,1,2), (2,2,1), (2,1,2), (1,2,2)<\/code><\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>13<\/td>\n<td><code>(1,1,1,1,1,1), (2,1,1,1,1), (1,2,1,1,1), (1,1,2,1,1), (1,1,1,2,1), (1,1,1,1,2), (2,2,1,1), (2,1,2,1), (2,1,1,2), (1,2,2,1), (1,2,1,2), (1,1,2,2), (2,2,2)<\/code><\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>21<\/td>\n<td><code>(1,1,1,1,1,1,1), (2,1,1,1,1,1), (1,2,1,1,1,1), (1,1,2,1,1,1), (1,1,1,2,1,1), (1,1,1,1,2,1), (1,1,1,1,1,2), (2,2,1,1,1), (2,1,2,1,1), (2,1,1,2,1), (2,1,1,1,2), (1,2,2,1,1), (1,2,1,2,1), (1,2,1,1,2), (1,1,2,2,1), (1,1,2,1,2), (1,1,1,2,2), (2,2,2,1), (2,2,1,2), (2,1,2,2), (1,2,2,2)<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  <\/p>\n<p><strong>\u041e\u0442\u0432\u0435\u0442:<\/strong> <code>fib(n + 1)<\/code>!?<\/p>\n<p>  <\/p>\n<p>\u042f \u0431\u044b\u043b \u0443\u0434\u0438\u0432\u043b\u0451\u043d, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 \u0432 \u0442\u0430\u043a\u043e\u043c \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439 \u044f \u0431\u044b\u043b \u0443\u0434\u0438\u0432\u043b\u0451\u043d \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435, <a href=\"http:\/\/people.sju.edu\/~rhall\/mathforpoets.pdf\">\u0443\u0437\u043d\u0430\u0432<\/a>, \u0447\u0442\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0435\u0449\u0451 \u0434\u0432\u0435 \u0442\u044b\u0441\u044f\u0447\u0438 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434. \u0421\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0446\u044b-\u043f\u0440\u043e\u0441\u043e\u0434\u0438\u0441\u0442\u044b \u0438\u0437 \u0434\u0440\u0435\u0432\u043d\u0435\u0439 \u0418\u043d\u0434\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u043b\u0438 \u0435\u0433\u043e, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0433\u043e\u0432 \u0432\u0435\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0435\u0441\u043d\u043e\u043f\u0435\u043d\u0438\u0439. \u041e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0438\u043a\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0433\u043b\u0430\u0432\u0435 7.2.1.7 \u043a\u043d\u0438\u0433\u0438 <em><a href=\"https:\/\/books.google.com\/books?id=56LNfE2QGtYC&amp;pg=PA50&amp;dq=Pingala#v=onepage&amp;q&amp;f=false\">The Art of Computer Programming<\/a><\/em> \u0414\u043e\u043d\u0430\u043b\u044c\u0434\u0430 \u041a\u043d\u0443\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u042f \u0431\u044b\u043b \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0451\u043d \u044d\u0442\u0438\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c, \u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043b\u0438: \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043e\u043a. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0439 \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u043f\u0440\u0438\u0448\u0451\u043b \u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u043a\u0430\u043a\u043e\u0435 \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c: \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0435\u0434\u0438\u043d\u0438\u0446 \u0438 \u0434\u0432\u043e\u0435\u043a, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435, \u0441\u0443\u043c\u043c\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0434\u043b\u0438\u043d\u043e\u0439 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430.<\/p>\n<p>  <\/p>\n<pre><code>from itertools import chain, product  def generate_groupings(word_length, glyph_sizes=(1, 2)):     cartesian_products = (         product(glyph_sizes, repeat=r)         for r in range(1, word_length + 1)     )      # \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432     groupings = tuple(         grouping         for grouping in chain.from_iterable(cartesian_products)         if sum(grouping) == word_length     )      return groupings<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D1%8F%D0%BC%D0%BE%D0%B5_%D0%BF%D1%80%D0%BE%D0%B8%D0%B7%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5\">\u0414\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a> \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439, \u0441\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Python \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/docs.python.org\/3\/library\/itertools.html#itertools.product\"><code>itertools.product()<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e. <code>cartesian_products<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 <code>glyph_sizes<\/code> \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 <code>word_length<\/code> \u0434\u043b\u0438\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 <code>word_length<\/code> \u0440\u0430\u0432\u043d\u043e 3, \u0442\u043e <code>cartesian_products<\/code> \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code>[     (1,), (2,), (1, 1), (1, 2), (2, 1), (2, 2), (1, 1, 1), (1, 1, 2),     (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2) ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b <code>groupings<\/code> \u0432\u043a\u043b\u044e\u0447\u0430\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 <code>word_length<\/code>.<\/p>\n<p>  <\/p>\n<pre><code>&gt;&gt;&gt; generate_groupings(3) ((1, 2), (2, 1), (1, 1, 1))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b\u0430 14 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439, \u043d\u043e \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e 3. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u0438\u043d\u044b \u0441\u043b\u043e\u0432\u0430. \u041d\u043e \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043f\u043e\u0437\u0436\u0435. \u0410 \u043f\u043e\u043a\u0430 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"sopostavlenie-slov-s-gruppirovkami\">\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432 \u0441 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043e\u043a \u0434\u043b\u044f \u0441\u043b\u043e\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u00ab\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u00bb \u0435\u0433\u043e \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043e\u043a:<\/p>\n<p>  <\/p>\n<pre><code>def map_word(word, grouping):     chars = (c for c in word)      mapped = []     for glyph_size in grouping:         glyph = &quot;&quot;         for _ in range(glyph_size):             glyph += next(chars)         mapped.append(glyph)      return tuple(mapped)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0435, \u043a\u0430\u043a \u0441 \u0447\u0430\u0448\u043a\u043e\u0439: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0435\u0451 \u0442\u0430\u043a\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430, \u043a\u0430\u043a\u0438\u043c \u0441\u043c\u043e\u0436\u0435\u0442, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443. \u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0430: <\/p>\n<p>  <\/p>\n<pre><code>&gt;&gt;&gt; map_word('because', (1, 2, 1, 1, 2)) ('b', 'ec', 'a', 'u', 'se')<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"poisk-variantov-napisaniya\">\u041f\u043e\u0438\u0441\u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>spell()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code>def spell(word, symbols=ELEMENTS):     groupings = generate_groupings(len(word))      spellings = [map_word(word, grouping) for grouping in groupings]      elemental_spellings = [         tuple(token.capitalize() for token in spelling)         for spelling in spellings         if set(s.lower() for s in spelling) &lt;= set(s.lower() for s in symbols)     ]      return elemental_spellings<\/code><\/pre>\n<p>  <\/p>\n<p><code>spell()<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0438\u0437 \u043d\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 (set).<\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432 Python \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u042d\u0442\u043e \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0417\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438 \u043e\u043d\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0438 (\u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u044b) \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u043d\u043e \u0431\u0435\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c\u044b, \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c (membership test) \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e (<a href=\"https:\/\/wiki.python.org\/moin\/TimeComplexity#set\">\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u041e(1)<\/a>). \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Subset\">\u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/a> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0435 <em><a href=\"http:\/\/shop.oreilly.com\/product\/0636920032519.do\">Fluent Python<\/a><\/em> \u041b\u0443\u0447\u0430\u043d\u043e \u0420\u0430\u043c\u0430\u043b\u044c\u043e (Luciano Ramalho).<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0438 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443!<\/p>\n<p>  <\/p>\n<pre><code>&gt;&gt;&gt; spell('amputation') [('Am', 'Pu', 'Ta', 'Ti', 'O', 'N'), ('Am', 'P', 'U', 'Ta', 'Ti', 'O', 'N')] &gt;&gt;&gt; spell('cryptographer') [('Cr', 'Y', 'Pt', 'Og', 'Ra', 'P', 'H', 'Er')]<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"samoe-dlinnoe-slovo\">\u0421\u0430\u043c\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e?<\/h2>\n<p>  <\/p>\n<p>\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u044f \u043d\u0430\u0437\u0432\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <a href=\"https:\/\/github.com\/mesbahamin\/stoichiograph\">Stoichiograph<\/a> \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u043d\u0435\u0451 \u043e\u0431\u0451\u0440\u0442\u043a\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0431\u0435\u0440\u0451\u0442 \u0441\u043b\u043e\u0432\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f. \u0414\u043e\u0431\u0430\u0432\u0438\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043b\u043e\u0432 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e, \u044f \u043d\u0430\u0442\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code>$ .\/stoichiograph.py --sort --batch-file \/usr\/share\/dict\/american-english NoNRePReSeNTaTiONaL NoNRePReSeNTaTiONAl [...]<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0421\u0430\u043c \u044f \u0431\u044b \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u043d\u0435 \u043d\u0430\u0448\u0451\u043b. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0443\u0436\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u042f \u043f\u043e\u0438\u0433\u0440\u0430\u043b\u0441\u044f \u0435\u0449\u0451 \u0438 \u043d\u0430\u0448\u0451\u043b \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e:<\/p>\n<p>  <\/p>\n<pre><code>$ .\/stoichiograph.py nonrepresentationalisms NoNRePReSeNTaTiONaLiSmS NONRePReSeNTaTiONaLiSmS NoNRePReSeNTaTiONAlISmS NONRePReSeNTaTiONAlISmS<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0443\u0437\u043d\u0430\u0442\u044c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e (<a href=\"https:\/\/www.amin.space\/blog\/2017\/5\/elemental_speller\/spoiler.txt\">\u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/a>), \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Longest_word_in_English\">\u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430<\/a>. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<h2 id=\"reshenie-problem-s-proizvoditelnostyu\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 119 095 \u0441\u043b\u043e\u0432 (\u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c\u0438) \u0437\u0430\u043d\u044f\u043b\u0430 \u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 16 \u043c\u0438\u043d\u0443\u0442:<\/p>\n<p>  <\/p>\n<pre><code>$ time .\/stoichiograph.py --sort --batch-file \/usr\/share\/dict\/american-english [...] real    16m0.458s user    15m33.680s sys     0m23.173s<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043e\u043a\u043e\u043b\u043e 120 \u0441\u043b\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u042f \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041c\u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u043a\u043e\u043f\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/rkern\/line_profiler\">Line profiler<\/a> \u2014 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 Python. \u042f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0438\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0438\u0441\u043a\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f 23-\u0431\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u0412\u043e\u0442 \u0441\u0436\u0430\u0442\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code>Line #   % Time   Line Contents ===============================     30            @profile     31            def spell(word, symbols=ELEMENTS):     32     71.0       groupings = generate_groupings(len(word))     33     34     15.2       spellings = [map_word(word, grouping) for grouping in groupings]     35     36                elemental_spellings = [     37      0.0           tuple(token.capitalize() for token in spelling)     38     13.8           for spelling in spellings     39                    if set(s.lower() for s in spelling) &lt;= set(s.lower() for s in symbols)     40                ]     41     42      0.0       return elemental_spellings  Line #   % Time   Line Contents ===============================     45            @profile     46            def generate_groupings(word_length, glyhp_sizes=(1, 2)):     47                cartesian_products = (     48      0.0           product(glyph_sizes, repeat=r)     49      0.0           for r in range(1, word_length + 1)     50                )     51     52      0.0       groupings = tuple(     53      0.0           grouping     54    100.0           for grouping in chain.from_iterable(cartesian_products)     55                    if sum(grouping) == word_length     56                )     57     58      0.0       return groupings<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e <code>generate_groupings()<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0434\u043e\u043b\u0433\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0430 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c, \u2014 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%97%D0%B0%D0%B4%D0%B0%D1%87%D0%B0_%D0%BE_%D1%81%D1%83%D0%BC%D0%BC%D0%B5_%D0%BF%D0%BE%D0%B4%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2\">\u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u0441\u0443\u043c\u043c\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/NP-%D0%BF%D0%BE%D0%BB%D0%BD%D0%B0%D1%8F_%D0%B7%D0%B0%D0%B4%D0%B0%D1%87%D0%B0\">NP-\u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439<\/a>. \u041f\u043e\u0438\u0441\u043a \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0440\u043e\u0433\u0438\u043c, \u0430 <code>generate_groupings()<\/code> \u0438\u0449\u0435\u0442 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0451 \u043f\u043b\u043e\u0445\u043e:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e <code>glyph_sizes<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0434\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (1 \u0438 2).<\/li>\n<li><code>product()<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442 <code>r<\/code> \u0440\u0430\u0437 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f <code>product()<\/code> \u0440\u0430\u0432\u043d\u0430 <code>O(2^r)<\/code>.<\/li>\n<li><code>product()<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f <code>word_length<\/code> \u0440\u0430\u0437, \u0442\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u044f\u0435\u043c <code>n<\/code> \u043a <code>word_length<\/code>, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 <code>O(2^r * n)<\/code>.<\/li>\n<li>\u041d\u043e <code>r<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u0446\u0438\u043a\u043b\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u043b\u0438\u0436\u0435 \u043a <code>O(2^1 + 2^2 + 2^3 + ... + 2^(n-1) + 2^n)<\/code>.<\/li>\n<li>\u0410 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <code>2^0 + 2^1 + ... + 2^n = 2^(n+1) - 1<\/code>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0432\u043d\u0430 <code>O(2^(n+1) - 1)<\/code>, \u0438\u043b\u0438 <code>O(2^n)<\/code>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0421 <code>O(2^n)<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 <code>word_length<\/code>. \u0423\u0436\u0430\u0441\u043d\u043e!<\/p>\n<p>  <\/p>\n<p>\u042f \u0440\u0430\u0437\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u043d\u0430\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u0435\u043b\u044c. \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0434\u0432\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b.<\/li>\n<li>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e, \u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u043b\u0438\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0430\u0436\u043d\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u043b\u0438\u044f\u043b\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e. \u0425\u043e\u0442\u044f \u044f \u0441\u0440\u0430\u0437\u0443 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u0438 \u0438\u0434\u0435\u0438 \u043d\u0430\u0441\u0447\u0451\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u044f \u0441 \u043d\u0435\u0433\u043e \u0438 \u043d\u0430\u0447\u0430\u043b.<\/p>\n<p>  <\/p>\n<h2 id=\"zadacha-1-byt-lenivym\">\u0417\u0430\u0434\u0430\u0447\u0430 1: \u0431\u044b\u0442\u044c \u043b\u0435\u043d\u0438\u0432\u044b\u043c<\/h2>\n<p>  <\/p>\n<p>\u041b\u0435\u043d\u044c \u2014 \u0434\u043e\u0431\u0440\u043e\u0434\u0435\u0442\u0435\u043b\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <a href=\"http:\/\/wiki.c2.com\/?LazinessImpatienceHubris\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432<\/a>, \u043d\u043e \u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u0435\u043d\u0438. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432, \u0442\u043e \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u044b?<\/p>\n<p>  <\/p>\n<h2 id=\"proverka-na-nepravilnye-simvoly\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0435\u0441\u0442\u044c \u0441\u043b\u043e\u0432\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u041c\u0435\u043d\u0434\u0435\u043b\u0435\u0435\u0432\u0430. \u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0435\u0441\u043b\u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0439\u0442\u0438 \u0438 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c j \u0438 q.<\/p>\n<p>  <\/p>\n<pre><code>&gt;&gt;&gt; set('abcdefghijklmnopqrstuvwxyz') - set(''.join(ELEMENTS).lower()) ('j', 'q')<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0442\u043e\u043b\u044c\u043a\u043e 3 % \u0441\u043b\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0438 \u044d\u0442\u0438 \u0431\u0443\u043a\u0432\u044b:<\/p>\n<p>  <\/p>\n<pre><code>&gt;&gt;&gt; with open('\/usr\/share\/dict\/american-english', 'r') as f: ...     words = f.readlines() ... &gt;&gt;&gt; total = len(words) &gt;&gt;&gt; invalid_char_words = len( ...     [w for w in words if 'j' in w.lower() or 'q' in w.lower()] ... ) ... &gt;&gt;&gt; invalid_char_words \/ total * 100 3.3762962340988287<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u043a\u0438\u043d\u0443\u0432 \u0438\u0445, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 2 %:<\/p>\n<p>  <\/p>\n<pre><code>$ time .\/stoichiograph.py --sort --batch-file \/usr\/share\/dict\/american-english [...] real    15m44.246s user    15m17.557s sys     0m22.980s<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u043d\u0430\u0434\u0435\u044f\u043b\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0434\u0435\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"memoizaciya\">\u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9C%D0%B5%D0%BC%D0%BE%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F\">\u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f<\/a> \u2014 \u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0438\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043d\u043e\u0432\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041c\u0435\u043c\u043e\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u043e\u0440\u043e\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0438\u0441\u0442\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p><code>generate_groupings()<\/code> \u0431\u044b\u043b\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u043c. \u041e\u043d\u0430 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0441\u044f \u0441 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0430 \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0432. \u041f\u0430\u043a\u0435\u0442 <code>functools<\/code> \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044e, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a href=\"https:\/\/docs.python.org\/3\/library\/functools.html#functools.lru_cache\"><code>@lru_cache()<\/code><\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f <code>generate_groupings()<\/code> \u043f\u0440\u0438\u0432\u0435\u043b\u0430 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u2014 \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0445\u043e\u0442\u044f \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code>$ time .\/stoichiograph.py --sort --batch-file \/usr\/share\/dict\/american-english [...] real    11m15.483s user    10m54.553s sys     0m17.083s<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438!<\/p>\n<p>  <\/p>\n<h2 id=\"zadacha-2-byt-umnym\">\u0417\u0430\u0434\u0430\u0447\u0430 2: \u0431\u044b\u0442\u044c \u0443\u043c\u043d\u044b\u043c<\/h2>\n<p>  <\/p>\n<p>\u041c\u043e\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u0438 \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043d\u0435\u0440\u0435\u0448\u0451\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b <code>generate_groupings()<\/code>, \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code>$ time .\/stoichiograph.py nonrepresentationalisms [...] real    0m20.275s user    0m20.220s sys     0m0.037s<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0435\u043d\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0443, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u043c\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"rekursiya-i-dag\">\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u0438 DAG<\/h2>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0440\u0435\u043c\u0430\u0432 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0432\u0435\u0447\u0435\u0440\u043e\u043c, \u044f \u0438\u0441\u043f\u044b\u0442\u0430\u043b \u0432\u0441\u043f\u044b\u0448\u043a\u0443 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0431\u0435\u0436\u0430\u043b \u043a \u043c\u0430\u0440\u043a\u0435\u0440\u043d\u043e\u0439 \u0434\u043e\u0441\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/708\/387\/258\/7083872584c4441993090c1c157769f9.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u043c\u043e\u0433\u0443 \u0432\u0437\u044f\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0434\u043d\u043e- \u0438 \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D0%B2%D0%BD%D0%B0%D1%8F_%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\">\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/a> \u043e\u0441\u0442\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0447\u0430\u0441\u0442\u044c. \u041f\u0440\u043e\u0439\u0434\u044f \u043f\u043e \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u044f \u043d\u0430\u0439\u0434\u0443 \u0432\u0441\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0436\u0435 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0433\u0440\u0430\u0444 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0438\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 amputation \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code>'a' 'mputation'     'm' 'putation'         'p' 'utation'             'u' 'tation'                 't' 'ation'                     'a' 'tion'                         't' 'ion'                             'i' 'on'                                 'o' 'n'                                     'n' ''                                 'on' ''                             'io' 'n'                         'ti' 'on'                     'at' 'ion'                 'ta' 'tion'             'ut' 'ation'         'pu' 'tation'     'mp' 'utation' 'am' 'putation'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u041c\u0435\u043d\u0434\u0435\u043b\u0435\u0435\u0432\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0433\u0440\u0430\u0444:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/b81\/f42\/0ab\/b81f420ab7b541c5b5ebec0953efbe9d.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9D%D0%B0%D0%BF%D1%80%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8B%D0%B9_%D0%B0%D1%86%D0%B8%D0%BA%D0%BB%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9_%D0%B3%D1%80%D0%B0%D1%84\">\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0444<\/a> (DAG), \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0412\u0441\u0435 \u043f\u0443\u0442\u0438 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432!<\/p>\n<p>  <\/p>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u044f \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 \u0433\u0440\u0430\u0444\u0430\u043c\u0438, \u043d\u043e \u043d\u0430\u0448\u0451\u043b \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 <a href=\"https:\/\/www.python.org\/doc\/essays\/graphs\/\">\u044d\u0441\u0441\u0435<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0432\u0441\u0435\u0445 \u043f\u0443\u0442\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0443\u0437\u043b\u0430\u043c\u0438. \u0412 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0435 <em><a href=\"http:\/\/aosabook.org\/en\/index.html\">500 Lines or Less<\/a><\/em> \u0435\u0441\u0442\u044c <a href=\"http:\/\/www.aosabook.org\/en\/500L\/contingent-a-fully-dynamic-build-system.html\">\u0433\u043b\u0430\u0432\u0430<\/a> \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0440\u0430\u0444\u0430 \u043d\u0430 Python. \u042d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u044f \u0438 \u0432\u0437\u044f\u043b \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b \u0441\u0432\u043e\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0430 \u0434\u043e\u0441\u043a\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code># \u041e\u0434\u0438\u043d \u0443\u0437\u0435\u043b \u0433\u0440\u0430\u0444\u0430. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0441\u043b\u043e\u0432\u0435. Node = namedtuple('Node', ['value', 'position'])  def build_spelling_graph(word, graph, symbols=ELEMENTS):     &quot;&quot;&quot;\u0414\u0430\u0451\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e \u0438 \u0433\u0440\u0430\u0444, \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043e\u0434\u043d\u043e- \u0438 \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0435     \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u0433\u0440\u0430\u0444, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442     \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.     &quot;&quot;&quot;      def pop_root(remaining, position=0, previous_root=None):         if remaining == '':             graph.add_edge(previous_root, None)             return          single_root = Node(remaining[0], position)         if single_root.value.capitalize() in symbols:             graph.add_edge(previous_root, single_root)              if remaining not in processed:                 pop_root(                     remaining[1:], position + 1, previous_root=single_root                 )          if len(remaining) &gt;= 2:             double_root = Node(remaining[0:2], position)             if double_root.value.capitalize() in symbols:                 graph.add_edge(previous_root, double_root)                  if remaining not in processed:                     pop_root(                         remaining[2:], position + 2, previous_root=double_root                     )         processed.add(remaining)      processed = set()     pop_root(word)<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"vyigrysh\">\u0412\u044b\u0438\u0433\u0440\u044b\u0448<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u00ab\u0432 \u043b\u043e\u0431\u00bb \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u0443\u0436\u0430\u0441\u043d\u043e \u0434\u043e\u043b\u0433\u043e (<code>O(2^n)<\/code>), \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0434\u043b\u0438\u043b\u0441\u044f <code>O(n)<\/code>. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435! \u041a\u043e\u0433\u0434\u0430 \u044f \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0433\u043d\u0430\u043b \u0441\u0432\u0435\u0436\u0435\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u0435, \u0442\u043e \u0431\u044b\u043b \u043f\u043e\u0442\u0440\u044f\u0441\u0451\u043d:<\/p>\n<p>  <\/p>\n<pre><code>$ time .\/stoichiograph.py --sort --batch-file \/usr\/share\/dict\/american-english [...] real    0m11.299s user    0m11.020s sys     0m0.17ys<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e 16 \u043c\u0438\u043d\u0443\u0442 \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b 10 \u0441\u0435\u043a\u0443\u043d\u0434, \u0432\u043c\u0435\u0441\u0442\u043e 120 \u0441\u043b\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u2014 10 800 \u0441\u043b\u043e\u0432!<\/p>\n<p>  <\/p>\n<p>\u0412\u043f\u0435\u0440\u0432\u044b\u0435 \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u043b \u0441\u0438\u043b\u0443 \u0438 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"samoe-dlinnoe-slovo-1\">\u0421\u0430\u043c\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/h2>\n<p>  <\/p>\n<p>\u0421 \u043d\u043e\u0432\u043e\u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0451\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u044f \u0441\u043c\u043e\u0433 \u043e\u0442\u044b\u0441\u043a\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c\u043e\u0435 \u043d\u0430 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b: floccinaucinihilipilificatiousness. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u043e\u0435 \u043e\u0442 <a href=\"https:\/\/ru.wiktionary.org\/wiki\/floccinaucinihilipilification\">floccinaucinihilipilification<\/a>, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0447\u0435\u043c\u0443-\u043b\u0438\u0431\u043e \u043a\u0430\u043a \u043a \u043d\u0435\u0432\u0430\u0436\u043d\u043e\u043c\u0443, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c\u0443. \u042d\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0430\u043c\u044b\u043c \u0434\u043b\u0438\u043d\u043d\u044b\u043c \u043d\u0435\u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u043b\u043e\u0432\u043e\u043c \u0432 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>Floccinaucinihilipilificatiousness \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 54 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0439, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/30e\/27b\/fe9\/30e27bfe9d29468e9ef86e5f85cdf594.png\" alt=\"image\"\/><br \/>  <a href=\"https:\/\/habrastorage.org\/web\/adc\/184\/6a4\/adc1846a4649469da1886e00f223f5e5.png\">\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"horosho-potrachennoe-vremya\">\u0425\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f<\/h2>\n<p>  <\/p>\n<p>\u041a\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u2014 \u043f\u043e\u043b\u043d\u0430\u044f \u0435\u0440\u0443\u043d\u0434\u0430, \u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0446\u0435\u043d\u043d\u044b\u043c \u0438 \u0432\u0430\u0436\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c. \u041a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0442\u043e \u0431\u044b\u043b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u043f\u044b\u0442\u0435\u043d \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c. \u0414\u0435\u043b\u043e \u0434\u0432\u0438\u0433\u0430\u043b\u043e\u0441\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0438 \u043f\u0440\u043e\u0448\u043b\u043e \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u043a\u0430 \u044f \u0434\u043e\u0431\u0438\u043b\u0441\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (\u0441\u043c. <a href=\"https:\/\/github.com\/mesbahamin\/stoichiograph\/commits\/master\">\u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432<\/a>, \u0442\u0430\u043c \u0432\u0438\u0434\u043d\u044b \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u044b, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b).<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u044f \u043c\u043d\u043e\u0433\u043e\u043c\u0443 \u043d\u0430\u0443\u0447\u0438\u043b\u0441\u044f \u0438 \u043c\u043d\u043e\u0433\u043e \u0441 \u0447\u0435\u043c \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f. \u042d\u0442\u043e:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0438\u043a\u0430<\/li>\n<li>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/li>\n<li>\u041c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u044f<\/li>\n<li>\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u044f<\/li>\n<li>\u0413\u0440\u0430\u0444\u044b \u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0432\u0430\u0436\u043d\u044b \u0434\u043b\u044f \u043c\u043e\u0435\u0433\u043e <a href=\"https:\/\/www.amin.space\/blog\/2017\/5\/quadtree_debug\/\">\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 n-\u0442\u0435\u043b<\/a> \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u044b\u0441\u043a\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0434 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438 \u0432\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>pip install stoichiograph<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"obsuzhdenie\">\u041e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0440\u044b\u0435 \u043b\u044e\u0434\u0438 (\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u0430\u0433\u043e\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0431\u043e\u0442\u043e\u0432) \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0432 <a href=\"https:\/\/www.reddit.com\/r\/programming\/comments\/6bgxia\/using_python_to_find_the_longest_word_spellable\/?ref=share&amp;ref_source=link\">\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0438<\/a> \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0432\u0435\u0442\u043a\u0435 r\/programming.<\/p>\n<p>  <\/p>\n<h2 id=\"dopmaterialy\">\u0414\u043e\u043f\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h2>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0435\u043c\u0430\u043b\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u0437 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u041f\u0438\u0442\u0435\u0440\u0443 \u041d\u043e\u0440\u0432\u0438\u0433\u0443 (Peter Norvig):<\/p>\n<p>  <\/p>\n<ul>\n<li><em><a href=\"http:\/\/norvig.com\/spell-correct.html\">How to Write a Spelling Corrector<\/a><\/em><\/li>\n<li><em><a href=\"http:\/\/norvig.com\/sudoku.html\">Solving Every Sudoku Puzzle<\/a><\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u0432\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 Python:<\/p>\n<p>  <\/p>\n<ul>\n<li><em><a href=\"http:\/\/blog.thehumangeo.com\/2015\/07\/28\/profiling-in-python\/\">Profiling in Python<\/a><\/em><\/li>\n<li><em><a href=\"https:\/\/www.huyng.com\/posts\/python-performance-analysis\">A Guide to Analyzing Python Performance<\/a><\/em><\/li>\n<\/ul>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/328986\/\"> https:\/\/habrahabr.ru\/post\/328986\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/0ce\/932\/5a9\/0ce9325a99ff4b5782697b2a737fd6b9.jpg\"\/><\/p>\n<p>  <\/p>\n<p><em>(\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/mesbahamin\/stoichiograph\">\u0442\u0443\u0442<\/a>)<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u0434\u044f \u043d\u0430 \u043f\u044f\u0442\u0438\u0447\u0430\u0441\u043e\u0432\u043e\u043c \u0437\u0430\u043d\u044f\u0442\u0438\u0438 \u043f\u043e \u0445\u0438\u043c\u0438\u0438, \u044f \u0447\u0430\u0441\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u0437\u0438\u043b \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u041c\u0435\u043d\u0434\u0435\u043b\u0435\u0435\u0432\u0430, \u0432\u0438\u0441\u044f\u0449\u0435\u0439 \u043d\u0430 \u0441\u0442\u0435\u043d\u0435. \u0427\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u0440\u043e\u0442\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433 \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u0438\u0448\u044c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: ScAlEs, FeArS, ErAsURe, WAsTe, PoInTlEsSnEsS, MoISTeN, SAlMoN, PuFFInEsS.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-286558","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286558","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=286558"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286558\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=286558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=286558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=286558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}