{"id":4965,"date":"2020-09-09T20:04:34","date_gmt":"2020-09-09T17:04:34","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=4965"},"modified":"2020-11-25T11:58:10","modified_gmt":"2020-11-25T08:58:10","slug":"e-olymp-8671-%d0%bf%d1%80%d0%b5%d0%b4%d1%81%d1%82%d0%b0%d0%b2%d0%b8%d0%bc%d1%8b%d0%b5-%d1%81%d1%83%d0%bc%d0%bc%d0%be%d0%b9-%d0%ba%d0%b2%d0%b0%d0%b4%d1%80%d0%b0%d1%82%d0%be%d0%b2","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=4965","title":{"rendered":"e-olymp 8671. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0441\u0443\u043c\u043c\u043e\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432"},"content":{"rendered":"<h1>\u0417\u0430\u0434\u0430\u0447\u0430<\/h1>\n<p>\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 $1$ \u0434\u043e $n$, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<h1>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u041e\u0434\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$ $( n \\leqslant 10000)$.<\/p>\n<h1>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h1>\n<p>\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 $1$ \u0434\u043e $n$, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<h1>\u0422\u0435\u0441\u0442\u044b<\/h1>\n<table style=\"height: 282px\" width=\"1028\">\n<tbody>\n<tr>\n<td>\u2116<\/td>\n<td style=\"text-align: left\">\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td style=\"text-align: left\">\u00a0\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\">1<\/td>\n<td style=\"text-align: left\">5<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>10<\/td>\n<td>5 10<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>13<\/td>\n<td>5 10 13<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>20<\/td>\n<td>5 10 13 17 20<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>30<\/td>\n<td>\u00a05 10 13 17 20 25 26 29<\/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 \">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\nimport java.util.Scanner;\r\n\r\npublic class Ideone{\r\n\tstatic boolean check(int n)\r\n\t{\r\n\t    \r\n\t    for (int i = 1; i * i &lt; n; i++) \/\/ \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 i\r\n\t    {   \r\n\t        double j = Math.sqrt (n - i * i);\r\n\t        if ((j == Math.floor(j)) &amp;&amp; (j != i)) \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 j \u0446\u0435\u043b\u043e\u0435 \u0438\u043b\u0438 \u0434\u0440\u043e\u0431\u043d\u043e\u0435 \r\n\t            {\r\n\t                return true; \/\/ \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0430\u0439\u0434\u0435\u043d\u0430 - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c true\r\n\t            }\r\n\t    } \r\n\t    return false; \/\/ \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c false\r\n\t}\r\n\tpublic static void main(String a[]) {\r\n\t    Scanner in = new Scanner(System.in);\r\n\t\tint n = in.nextInt();\t \/\/ \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e, \u0434\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c\r\n\t    for (int k = 5; k &lt;= n; k++) \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e k\r\n\t        if (check(k))\r\n\t            System.out.print(k + \" \");\r\n\t\tin.close();\r\n\t}\r\n}\r\n<\/pre>\n<h1>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h1>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>check()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c $true$, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0438\u043b\u0438 \u0436\u0435 $false$, \u0435\u0441\u043b\u0438 \u043d\u0435\u043b\u044c\u0437\u044f. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b $i$ \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c $j$ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e $i$ \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 $j=\\sqrt{n-i^2}$, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c \u0446\u0435\u043b\u043e\u0435 (\u043d\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 $i$ ) $j$ \u0438\u043b\u0438 \u0436\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 $i$. \u041f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0434\u043e $ i \\cdot i &lt; n $,\u00a0 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430. \u0424\u043e\u0440\u043c\u0443\u043b\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u044b\u0440\u0430\u0437\u0438\u0432 $j$ \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u044b $(i^2+j^2=n)$.<\/p>\n<h1>\u0421\u0441\u044b\u043b\u043a\u0438<\/h1>\n<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 <a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/8671\" target=\"_blank\" rel=\"noopener noreferrer\">e-olymp<\/a><\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 <a href=\"https:\/\/ideone.com\/kWU1Wq\" target=\"_blank\" rel=\"noopener noreferrer\">ideone<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 $1$ \u0434\u043e $n$, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u041e\u0434\u043d\u043e \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $n$ $( n \\leqslant 10000)$. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u043e\u0442 $1$ \u0434\u043e $n$, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0432\u0443\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0422\u0435\u0441\u0442\u044b \u2116 \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=4965\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":142,"featured_media":5075,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[520,494,75],"jetpack_featured_media_url":"https:\/\/java.mazurok.com\/wp-content\/uploads\/depositphotos_34096673-stock-photo-abstract-squares-3d-design-background1.jpg","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4965"}],"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\/142"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4965"}],"version-history":[{"count":1,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4965\/revisions"}],"predecessor-version":[{"id":4966,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/4965\/revisions\/4966"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/media\/5075"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}