{"id":5000,"date":"2020-09-10T20:14:11","date_gmt":"2020-09-10T17:14:11","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=5000"},"modified":"2020-09-13T21:14:11","modified_gmt":"2020-09-13T18:14:11","slug":"e-olymp-123-%d0%ba%d0%be%d0%bb%d0%b8%d1%87%d0%b5%d1%81%d1%82%d0%b2%d0%be-%d0%bd%d1%83%d0%bb%d0%b5%d0%b9-%d1%83-%d1%84%d0%b0%d0%ba%d1%82%d0%be%d1%80%d0%b8%d0%b0%d0%bb%d0%b0","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=5000","title":{"rendered":"e-olymp 123. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u0443 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0447\u0438\u0441\u043b\u0430 $n$.<\/p>\n<h2>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e $n$ $(1 \\leqslant n \\leqslant2\\cdot10^9)$<\/p>\n<h2>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h2>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 $n!$<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table style=\"height: 102px\" width=\"385\">\n<tbody>\n<tr>\n<td><span class=\"hljs-tag\">\u2116<\/span><\/td>\n<td>\u0412\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/td>\n<td>\u0412\u042b\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/td>\n<\/tr>\n<tr>\n<td>\u00a01<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>\u00a02<\/td>\n<td>7<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>\u00a03<\/td>\n<td>12<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>\u00a04<\/td>\n<td>100<\/td>\n<td>24<\/td>\n<\/tr>\n<tr>\n<td>\u00a05<\/td>\n<td>306<\/td>\n<td>75<\/td>\n<\/tr>\n<tr>\n<td>\u00a06<\/td>\n<td>5000<\/td>\n<td>1249<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434<\/h1>\n<pre class=\"lang:java decode:true \">class Main{\r\n\tpublic static void main (String[] args){\r\n\t\tjava.util.Scanner in = new java.util.Scanner(System.in); \r\n\t\tlong n = in.nextInt(), m = 5, s = 0;\r\n\t\twhile(n &gt;= m){\r\n\t\t\ts = s + (n \/ m); \r\n\t\t\tm = m * 5;\r\n\t\t}\r\n\t\tSystem.out.println(s);\r\n\t}\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u0443\u043b\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b 2 \u0438 5 &#8212; \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u0442. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 5 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 2. \u0417\u043d\u0430\u0447\u0438\u0442, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439-\u043f\u044f\u0442\u0435\u0440\u043e\u043a. \u041e\u0434\u0438\u043d \u0442\u0430\u043a\u043e\u0439 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0447\u0438\u0441\u043b\u0430 5, 10, 15, 20, 25, &#8230;, $n$ &#8212; \u0432\u0441\u0435\u0433\u043e \u0438\u0445 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f $\\frac{n}{5}$. \u0414\u0432\u0430 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0447\u0438\u0441\u043b\u0430 25, 50, &#8230;, $n$ \u0432\u0441\u0435\u0433\u043e \u0438\u0445 $\\frac{n}{5^2}$.\u0422\u0440\u0438 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 $\\frac{n}{5^3}$.\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0438\u0445 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f, \u043d\u0430\u0439\u0434\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e:<\/p>\n<p>$\\lfloor\\frac{n}{5}\\rfloor+\\lfloor\\frac{n}{5^2}\\rfloor+\\lfloor\\frac{n}{5^3}\\rfloor+\\ldots+\\lfloor\\frac{n}{5^k}\\rfloor$<\/p>\n<p style=\"font-weight: 400\">\u0421\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0435 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0432\u043d\u044b\u043c 0.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>\u0424\u043e\u0440\u043c\u0443\u043b\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B0%D0%BA%D1%82%D0%BE%D1%80%D0%B8%D0%B0%D0%BB#%D0%A0%D0%B0%D0%B7%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BD%D0%B0_%D0%BF%D1%80%D0%BE%D1%81%D1%82%D1%8B%D0%B5_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B8%D1%82%D0%B5%D0%BB%D0%B8\">\u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0438<\/a><\/p>\n<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u00a0<a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/123\">e-olymp<\/a><\/p>\n<p>\u041a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/ideone.com\/nTOtbU\">Ideone<\/a><\/p>\n<p>\u0417\u0430\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0<a href=\"https:\/\/www.e-olymp.com\/ru\/submissions\/7307594\">e-olymp\u00a0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u041d\u0430\u0439\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0447\u0438\u0441\u043b\u0430 $n$. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e $n$ $(1 \\leqslant n \\leqslant2\\cdot10^9)$ \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0443\u043b\u0435\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 $n!$ \u0422\u0435\u0441\u0442\u044b \u2116 \u0412\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415 \u0412\u042b\u0425\u041e\u0414\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415 \u00a01 1 0 \u00a02 7 1 \u00a03 12 2 \u00a04 100 24 \u00a05 306 75 \u00a06 5000 1249 \u041a\u043e\u0434 class Main{ public &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=5000\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":177,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,6],"tags":[140,231,686],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5000"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/177"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5000"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5000\/revisions"}],"predecessor-version":[{"id":5001,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/5000\/revisions\/5001"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}