{"id":303018,"date":"2020-05-04T21:00:24","date_gmt":"2020-05-04T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303018"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303018","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439: \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043f\u0435\u0440\u043c\u0443\u0442\u0430\u0446\u0438\u044f\u043c"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500368\/\">\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0430\u0446\u0438\u0438. \u041e\u0434\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0442\u0435\u0441\u0442, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0442\u0438\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b\u044b. \u0410 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u0441\u0442\u043e\u044f\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0435\u0451 \u0443 \u043d\u0430\u0441 \u0431\u044b\u0441\u0442\u0440\u043e. \u0410 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c n \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0418\u0437 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0438\u043a\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c n &gt; 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043c\u044b, \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438, \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0432\u043d\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/514\/81f\/3b8\/51481f3b804e488c308961363a39722f.svg\" alt=\"$n!$\" data-tex=\"inline\"><\/math>. \u0412\u043e\u0442 \u0438 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e, \u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0430\u043c \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c n-\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0430 \u0441\u0430\u043c\u043e \u0447\u0438\u0441\u043b\u043e n \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0411\u0414. \u0425\u0440\u0435\u043d\u0430\u043a-\u0445\u0440\u0435\u043d\u0430\u043a \u0438 <s>\u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d<\/s> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u0441\u0442\u0435\u0440\u0430\u043c. \u0418 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0432\u0435\u0434\u044c \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u043e\u0435, \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e<\/h3>\n<p>  <\/p>\n<p>\u0410 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/be1\/f92\/7a8\/be1f927a81bab8fcef521eb9cace51a3.svg\" alt=\"$21! = \u202d51\u00a0090\u00a0942\u00a0171\u00a0709\u00a0440\u00a0000\u202c$\" data-tex=\"inline\"><\/math>. \u0425\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0447\u0438\u0441\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0435 20-\u0438 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 13-\u0438) \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0435 \u0443\u0447\u043b\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0435\u0441\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u043e \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u0430\u043a-\u0442\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0443. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u043e\u0434-\u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u0438\u0445. \u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0439, \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c, \u043d\u043e \u0440\u0430\u0437 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u043c\u043d\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0439\u0442\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c.<\/p>\n<p>  <\/p>\n<h3>\u041e \u043d\u043e\u0432\u044b\u0439 \u0434\u0438\u0432\u043d\u044b\u0439 \u043f\u0443\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u044f \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u2014 \u00ab\u0410 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u0435\u0451 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f?\u00bb. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0442\u043e\u0440\u043e\u0435, \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043f\u0435\u0440\u043c\u0443\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u0438\u043c \u0443\u0433\u043b\u043e\u043c. \u0412\u0435\u0434\u044c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0441\u0435\u0433\u043e-\u0442\u043e \u0438\u0437 n \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0430 \u0441\u0430\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u0435\u0434\u0438\u043d\u043e\u0436\u0434\u044b. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u043e \u0443\u0436\u0435 \u0438\u0437 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0418 \u0442\u0430\u043a n \u0440\u0430\u0437, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u043d\u0430\u0448\u0443 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bn\/34\/jw\/bn34jw8gz-5wijpzey3usjq0gsk.png\"><\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0434\u0435\u044e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public static int[] generateArray(int n) { \tint[] array = new int[n];  \tfor (int i = 0; i &lt; n; i++) { \t\tarray[i] = i; \t}  \treturn array; } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0447\u0442\u043e \u0432 Java \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">int[] arrayCopy = Array.copyOf(mainArray, mainArray.length); <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public static int[] shuffleArray(int[] array, Random rand) { \tint[] shuffledArray = new int[array.length];  \tfor (int i = 0; i &lt; array.length; i++) { \t\tint origIndex = rand.nextInt(array.length - i); \t\tshuffledArray[i] = array[origIndex];  \t\tint temp = array[origIndex]; \t\tarray[origIndex] = array[array.length - i - 1]; \t\tarray[array.length - i - 1] = temp; \t}  \treturn shuffledArray; } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c seed \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0448\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u0430, \u0430 \u0441\u0430\u043c\u043e \u0447\u0438\u0441\u043b\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u043b\u044e\u0431\u043e\u0435, \u0431\u0443\u0434\u044c \u0442\u043e \u043d\u043e\u043c\u0435\u0440 \u0441\u0435\u0441\u0441\u0438\u0438, \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0442\u0430\u043a\u043e\u0435-\u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public static void main(String[] args) { \tint[] mainArray = generateArray(30); \tint[] arrayCopy = Arrays.copyOf(mainArray, mainArray.length);  \tRandom rand = new Random(419L); \tint[] shuffledArray = shuffleArray(arrayCopy, rand);  \tfor (int i = 0; i &lt; shuffledArray.length; i++) { \t\tSystem.out.print(shuffledArray[i] + &quot; &quot;); \t}  \tSystem.out.println(); } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0440\u0430\u0432 \u0432\u0441\u0435 \u0432\u043e\u0435\u0434\u0438\u043d\u043e, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3b3\/7f3\/0f2\/3b37f30f255db9e1e93d63099fa0d62c.svg\" alt=\"$O(n)$\" data-tex=\"inline\"><\/math> \u0438 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043b\u0435\u0433\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043e\u043d \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">import java.util.Random; import java.util.Arrays;  public class Shuffle { \tpublic static void main(String[] args) { \t\tint[] mainArray = generateArray(30); \t\tint[] arrayCopy = Arrays.copyOf(mainArray, mainArray.length);  \t\tRandom rand = new Random(419L); \t\tint[] shuffledArray = shuffleArray(arrayCopy, rand);  \t\tfor (int i = 0; i &lt; shuffledArray.length; i++) { \t\t\tSystem.out.print(shuffledArray[i] + &quot; &quot;); \t\t}  \t\tSystem.out.println(); \t}  \tpublic static int[] generateArray(int n) { \t\tint[] array = new int[n];  \t\tfor (int i = 0; i &lt; n; i++) { \t\t\tarray[i] = i; \t\t}  \t\treturn array; \t}  \tpublic static int[] shuffleArray(int[] array, Random rand) { \t\tint[] shuffledArray = new int[array.length];  \t\tfor (int i = 0; i &lt; array.length; i++) { \t\t\tint origIndex = rand.nextInt(array.length - i); \t\t\tshuffledArray[i] = array[origIndex];  \t\t\tint temp = array[origIndex]; \t\t\tarray[origIndex] = array[array.length - i - 1]; \t\t\tarray[array.length - i - 1] = temp; \t\t}  \t\treturn shuffledArray; \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0438\u0441\u043a\u0430\u043b\u0438, \u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0445\u043e\u0442\u044c \u043e\u043d \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0441\u0435\u043b (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043c\u043d\u0435 \u0438 \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e), \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c n-\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043c\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0448 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"java\">public static int[] subArrayElem(int nth, int elemNumber) { \tint[] sequence = new int[elemNumber];  \tfor (int i = 1; i &lt;= elemNumber; i++) { \t\tsequence[elemNumber - i] = nth % i; \t\tnth \/= i; \t}  \treturn sequence; } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u043d\u0443\u0436\u043d\u043e\u0439 \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043f\u043e\u043c\u0435\u0449\u0430\u044f \u043a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u041a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434-\u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u043f\u0435\u0440\u043c\u0443\u0442\u0430\u0446\u0438\u044e. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public static int[] shuffleArray(int[] array, int nth) { \tint[] shuffledArray = new int[array.length]; \tint[] sequence = subArrayElem(nth, array.length);  \tfor (int i = 0; i &lt; array.length; i++) { \t\tint origIndex = sequence[i]; \t\tshuffledArray[i] = array[origIndex]; \t\tshiftArray(array, origIndex); \t}  \treturn shuffledArray; }  public static void shiftArray(int[] array, int index) { \tfor (int i = index; i &lt; array.length - 1; i++) { \t\tarray[i] = array[i + 1]; \t} } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0435\u0440\u043c\u0443\u0442\u0430\u0446\u0438\u044e, \u043d\u043e\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0430\u0448 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c.<\/p>\n<p>  <\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c BigInteger, \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0447\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430. \u0422\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430 \u0438 \u0435\u0439 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0443-\u0442\u043e \u043e\u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435, \u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0443. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0430\u0448\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435, \u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c, \u0430 \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435? \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0432\u0441\u0435 \u0438 \u0431\u044b\u043b\u043e.<\/p>\n<p>  <b>UPD:<\/b><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u044d\u0442\u043e \u043f\u0438\u0441\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0438\u0441\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u043d\u0430 Java, \u0442\u0430\u043c \u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0438\u043f\u0430 java.util.Collections.shuffle() \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u0430. \u0410 \u0449\u0430\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 Java \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0439 \u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b. \u0414\u0443\u043c\u0430\u044e \u0441\u0442\u043e\u0438\u0442 \u044d\u0442\u043e \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/500368\/\"> https:\/\/habr.com\/ru\/post\/500368\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500368\/\">\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u044d\u043a\u0437\u0430\u043c\u0435\u043d\u0430\u0446\u0438\u0438. \u041e\u0434\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0442\u0435\u0441\u0442, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0442\u0438\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043a\u0430\u043a \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u043b\u044b. \u0410 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u0441\u0442\u043e\u044f\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0435\u0451 \u0443 \u043d\u0430\u0441 \u0431\u044b\u0441\u0442\u0440\u043e. \u0410 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c: \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c n \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0418\u0437 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u0438\u043a\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c n &gt; 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043c\u044b, \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438, \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0433\u0434\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0432\u043d\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/514\/81f\/3b8\/51481f3b804e488c308961363a39722f.svg\" alt=\"$n!$\" data-tex=\"inline\"><\/math>. \u0412\u043e\u0442 \u0438 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e, \u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0430\u043c \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c n-\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0430 \u0441\u0430\u043c\u043e \u0447\u0438\u0441\u043b\u043e n \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e \u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0411\u0414. \u0425\u0440\u0435\u043d\u0430\u043a-\u0445\u0440\u0435\u043d\u0430\u043a \u0438 <s>\u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d<\/s> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u0441\u0442\u0435\u0440\u0430\u043c. \u0418 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0432\u0435\u0434\u044c \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u043e\u0435, \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e.<\/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-303018","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303018","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=303018"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303018\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}