{"id":3108,"date":"2017-08-23T00:57:42","date_gmt":"2017-08-22T21:57:42","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3108"},"modified":"2017-11-28T02:14:58","modified_gmt":"2017-11-27T23:14:58","slug":"e-olymp-109-%d0%bd%d1%83%d0%bc%d0%b5%d1%80%d0%b0%d1%86%d0%b8%d1%8f","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3108","title":{"rendered":"e-olymp 109. \u041d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f"},"content":{"rendered":"<h1><strong>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/strong><\/h1>\n<p>\u0414\u043b\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438\u00a0 $latex m$\u00a0\u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043a\u043d\u0438\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u00a0$latex n$\u00a0\u0446\u0438\u0444\u0440. \u041f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443\u00a0$latex n$\u00a0\u0432\u044b\u0432\u0435\u0441\u0442\u0438\u00a0$latex m$\u00a0\u0438\u043b\u0438\u00a0$latex 0$, \u0435\u0441\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<h1><strong>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/h1>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00a0<strong>n<\/strong>. \u0412 \u043a\u043d\u0438\u0433\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435\u00a0<strong>1001<\/strong>\u00a0\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<h1><strong>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/strong><\/h1>\n<p>\u0418\u0441\u043a\u043e\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<\/p>\n<h1><strong>\u0422\u0435\u0441\u0442\u044b<\/strong><\/h1>\n<table>\n<tbody>\n<tr>\n<td>\u2116<\/td>\n<td>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>27<\/td>\n<td>18<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1><strong>\u041a\u043e\u0434<\/strong><\/h1>\n<pre class=\"lang:java decode:true  \">import java.util.*;\r\nimport java.lang.Math.*;\r\n\r\nclass Task3\r\n{\r\n\tpublic static void main (String[] args)\r\n\t{\r\n\t    int N;\r\n\t    Scanner in = new Scanner(System.in);\r\n\t    N = in.nextInt();\r\n\t    for (int i = 1; true; i++) \/\/ i - \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0442 N \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440 \u0432 i\r\n\t    {\r\n\t\t    N -= Math.floor(Math.log10(i) + 1);\r\n\t\t    if (N == 0) \/\/ \u0435\u0441\u043b\u0438 \u043b\u0438\u0448\u043d\u0438\u0445 \u0446\u0438\u0444\u0440 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c\r\n\t\t    {\r\n\t\t\t    System.out.println(i);\r\n\t\t\t    break;\r\n\t\t    }\r\n\t\t    else if (N &lt; 0) \/\/ \u0438\u043d\u0430\u0447\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \"0\"\r\n\t\t    {\r\n\t\t\t    System.out.println(0);\r\n\t\t\t    break;\r\n\t\t    }\r\n\t    }\r\n\t}\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h1><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/strong><\/h1>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0446\u0438\u0444\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u0412\u0432\u043e\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438\u00a0\u0432\u044b\u0432\u043e\u0434\u0438\u043c, \u043a\u0430\u043a\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044e $latex 10$.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 27 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\u00a0 <a href=\"https:\/\/ideone.com\/5WQnjx\" target=\"_blank\" rel=\"noopener\">ideone.<\/a><br \/>\n\u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e <a href=\"http:\/\/cpp.mazurok.com\/e-olymp-109\/\" target=\"_blank\" rel=\"noopener\">\u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438 \u0414\u043b\u044f \u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u0438\u00a0 $latex m$\u00a0\u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043a\u043d\u0438\u0433\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u00a0$latex n$\u00a0\u0446\u0438\u0444\u0440. \u041f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443\u00a0$latex n$\u00a0\u0432\u044b\u0432\u0435\u0441\u0442\u0438\u00a0$latex m$\u00a0\u0438\u043b\u0438\u00a0$latex 0$, \u0435\u0441\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00a0n. \u0412 \u043a\u043d\u0438\u0433\u0435 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435\u00a01001\u00a0\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0418\u0441\u043a\u043e\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u0422\u0435\u0441\u0442\u044b \u2116 \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 1 27 18 \u041a\u043e\u0434 import java.util.*; import java.lang.Math.*; class Task3 { public static &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3108\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":104,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[216,41,242,219,75,317],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3108"}],"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\/104"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3108"}],"version-history":[{"count":4,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3108\/revisions"}],"predecessor-version":[{"id":3213,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3108\/revisions\/3213"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}