{"id":3317,"date":"2017-11-28T22:22:59","date_gmt":"2017-11-28T19:22:59","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=3317"},"modified":"2017-12-06T00:22:02","modified_gmt":"2017-12-05T21:22:02","slug":"%d1%8e-4-24","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=3317","title":{"rendered":"\u042e 4.24"},"content":{"rendered":"<h2>\u0417\u0430\u0434\u0430\u0447\u0430:<\/h2>\n<p>\u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <span id=\"MathJax-Element-7-Frame\" class=\"MathJax_SVG\" style=\"border: 0px;font-family: inherit;font-size: 13px;font-style: normal;font-weight: normal;margin: 0px;padding: 0px;vertical-align: baseline;line-height: normal;text-indent: 0px;text-align: left;letter-spacing: normal;float: none;direction: ltr;max-width: none;max-height: none;min-width: 0px;min-height: 0px\" role=\"presentation\"><span class=\"MJX_Assistive_MathML\" role=\"presentation\">[latex]A[n][\/latex]<\/span><\/span><span id=\"MathJax-Element-3-Frame\" class=\"MathJax_SVG\" style=\"border: 0px;font-family: inherit;font-size: 13px;font-style: normal;font-weight: normal;margin: 0px;padding: 0px;vertical-align: baseline;line-height: normal;text-indent: 0px;text-align: left;letter-spacing: normal;float: none;direction: ltr;max-width: none;max-height: none;min-width: 0px;min-height: 0px\" role=\"presentation\"><span class=\"MJX_Assistive_MathML\" role=\"presentation\">\u00a0<\/span><\/span>\u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u0440\u043e\u043c\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u043e\u0439 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<table style=\"width: 475px\" border=\"3\">\n<caption>\u00a0<\/caption>\n<tbody>\n<tr>\n<td style=\"width: 158px\">\u0412\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td style=\"width: 201px\">\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0432\u044b\u0432\u043e\u0434<\/td>\n<td style=\"width: 126px\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 158px\">1 1 1 1 1 1<\/td>\n<td style=\"width: 201px\">1 1 2 3 4 5<\/td>\n<td style=\"width: 126px\">\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 158px\">1 2 3 4 5 6 7 8 9<\/td>\n<td style=\"width: 201px\">1 1 3 6 10 15 21 28 36<\/td>\n<td style=\"width: 126px\">\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 158px\">3 5 2 9 0 4 65 156 1<\/td>\n<td style=\"width: 201px\">3 3 8 10 19 19 23 88 244<\/td>\n<td style=\"width: 126px\">\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 158px\">2 -7 3 8 -4 5 -2 4 2<\/td>\n<td style=\"width: 201px\">2 2 -5 -2 6 2 7 5 9<\/td>\n<td style=\"width: 126px\">\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u041a\u043e\u0434:<\/h2>\n<pre class=\"lang:java decode:true\">import java.util.*;\r\n\r\n\r\npublic class cu_total {\r\n    public static void main(String[] args){\r\n        Scanner in = new Scanner(System.in);\r\n        System.out.print(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 n: \");\r\n        int n = in.nextInt(); \/\/\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430\r\n        int[] a = new int[n]; \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\r\n        for(int i=0;i&lt;n;i++){ \/\/\u0412\u0432\u043e\u0434 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0438\u043a\u043b\u0430\r\n            System.out.print(\"\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438: \");\r\n            a[i] = in.nextInt();\r\n        }\r\n        int b[] = new int[n]; \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\r\n        int S=0;              \/\/\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439\r\n        b[0]=a[0];            \/\/\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\r\n        for(int i=1;i&lt;n;i++)  \/\/\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0432\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\r\n        {\r\n            S+=a[i-1];\r\n            b[i]=S;\r\n        }\r\n        for(int i=0;i&lt;n;i++){\r\n            System.out.println(b[i]);\r\n        }\r\n        System.out.print(\"\\n\" + \"\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\");\r\n    }\r\n}<\/pre>\n<h2>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435:<\/h2>\n<p>\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0438\u043a\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u0441\u043d\u043e\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0438\u043a\u043b\u0430, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/h2>\n<ol>\n<li>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u0432\u0432\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430, \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u00a0\u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430, \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/li>\n<li>\u041e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/li>\n<\/ol>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 <a href=\"https:\/\/ideone.com\/nLskr1\">Ideone.com<\/a><\/p>\n<p><a href=\"http:\/\/cpp.mazurok.com\/%D1%8E4-24-2\/\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430: \u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 [latex]A[n][\/latex]\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u0440\u043e\u043c\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u043c\u043c\u043e\u0439 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u00a0 \u0412\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 1 1 1 1 1 1 1 1 2 3 4 5 \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d 1 2 3 4 5 6 7 8 9 1 1 3 6 10 15 21 28 36 \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d 3 5 2 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=3317\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":101,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[41,134,135,75,324],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3317"}],"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\/101"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3317"}],"version-history":[{"count":16,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3317\/revisions"}],"predecessor-version":[{"id":3358,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/3317\/revisions\/3358"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}