{"id":3923,"date":"2018-12-02T18:04:34","date_gmt":"2018-12-02T15:04:34","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3923"},"modified":"2018-12-19T00:31:38","modified_gmt":"2018-12-18T21:31:38","slug":"e-olymp-481-%d0%b8-%d0%be%d0%bf%d1%8f%d1%82%d1%8c-%d1%81%d0%ba%d0%be%d0%bb%d1%8c%d0%ba%d0%be-%d0%bc%d0%be%d0%b6%d0%bd%d0%be","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3923","title":{"rendered":"e-olymp 481. \u0418 \u043e\u043f\u044f\u0442\u044c: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e?"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u0417\u0430\u0434\u0430\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e [latex]N[\/latex]. \u041e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0447\u0442\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u0446\u0438\u0444\u0440 \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u043f\u044f\u0442\u044c \u0432\u044b\u0447\u0442\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u0446\u0438\u0444\u0440 \u0438 \u0442.\u0434. \u0414\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e?<\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e [latex]N[\/latex], \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 [latex]2147483647[\/latex].<\/p>\n<h1>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table>\n<tbody>\n<tr>\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>[latex]23[\/latex]<\/td>\n<td>[latex]3[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]55555[\/latex]<\/td>\n<td>[latex]3000[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]1234567[\/latex]<\/td>\n<td>[latex]49877[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]999999999[\/latex]<\/td>\n<td>[latex]25632473[\/latex]<\/td>\n<\/tr>\n<tr>\n<td>[latex]2147483647[\/latex]<\/td>\n<td>[latex]54682584[\/latex]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h1>\n<pre class=\"lang:java decode:true \" title=\"e-olymp 481. And again: how many times? solution\">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\nclass Main\r\n{\r\n\tpublic static void main (String[] args) throws java.lang.Exception\r\n\t{\r\n\t\tlong N, sum, subsidiary = 0, quantity = 0;\r\n    \tScanner in = new Scanner(System.in);\r\n    \tN = in.nextLong();\r\n    \twhile (N &gt; 999999999) {\r\n        \tsum = 0;\r\n        \tsubsidiary = N;\r\n        \twhile (subsidiary!=0) {\r\n            \tsum += subsidiary%10;\r\n            \tsubsidiary \/= 10;\r\n        \t}\r\n        \tN -= sum;\r\n        \tquantity++;\r\n    \t}\r\n    \tif (N == 999999999) {\r\n        \tN = 0;\r\n        \tquantity += 25632473;\r\n    \t}\r\n    \twhile (N &gt; 0) {\r\n        \tsum = 0;\r\n        \tsubsidiary = N;\r\n        \twhile (subsidiary != 0) {\r\n            \tsum += subsidiary%10;\r\n            \tsubsidiary \/= 10;\r\n        \t}\r\n        \tN -= sum;\r\n        \tquantity++;\r\n    \t}\r\n    \tSystem.out.println(quantity);\r\n\t}\r\n}<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h1>\n<p>\u0414\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u0432\u044b\u0447\u0438\u0442\u0430\u044f \u043e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 [latex]N[\/latex] \u0441\u0443\u043c\u043c\u044b \u0446\u0438\u0444\u0440, \u043f\u043e\u043a\u0430 \u0441\u0430\u043c\u043e \u0447\u0438\u0441\u043b\u043e \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442  \u0440\u0430\u0432\u043d\u044b\u043c [latex]0[\/latex], \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0438\u043a\u043b\u043e\u0432. \u041d\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<br \/>\n\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0430\u0439\u0434\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0438 \u0438\u0437 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u0441\u0443\u043c\u043c \u0446\u0438\u0444\u0440 \u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e &#8212; [latex]999999999[\/latex] (\u043d\u0430\u0439\u0434\u0435\u043d\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c). \u0418\u0437 \u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0441\u0443\u043c\u043c\u044b \u0446\u0438\u0444\u0440 [latex]25632473[\/latex] \u0440\u0430\u0437, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f [latex]0[\/latex].<br \/>\n\u0422\u043e\u0433\u0434\u0430 \u0438\u0437 \u0447\u0438\u0441\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u044b \u0446\u0438\u0444\u0440, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u0441\u0442\u0430\u043d\u0443\u0442 \u0440\u0430\u0432\u043d\u044b\u043c\u0438 [latex]999999999[\/latex] \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0439 [latex]25632473[\/latex].<br \/>\n\u0415\u0441\u043b\u0438 [latex]N[\/latex] \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u044b \u0446\u0438\u0444\u0440, \u043f\u043e\u043a\u0430 \u043e\u043d\u043e \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0432\u043d\u044b\u043c [latex]0[\/latex].<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p><a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/481\" rel=\"noopener\" target=\"_blank\">\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 e-olymp<\/a><br \/>\n<a href=\"https:\/\/ideone.com\/iR3HBb\" rel=\"noopener\" target=\"_blank\">\u041a\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0417\u0430\u0434\u0430\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e [latex]N[\/latex]. \u041e\u0442 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0447\u0442\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u0446\u0438\u0444\u0440 \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u043e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u043f\u044f\u0442\u044c \u0432\u044b\u0447\u0442\u0435\u043c \u0441\u0443\u043c\u043c\u0443 \u0446\u0438\u0444\u0440 \u0438 \u0442.\u0434. \u0414\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e? \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e [latex]N[\/latex], \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 [latex]2147483647[\/latex]. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3923\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":131,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,14],"tags":[484,485,486,99],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3923"}],"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\/131"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3923"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3923\/revisions"}],"predecessor-version":[{"id":3924,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3923\/revisions\/3924"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}