{"id":595,"date":"2023-03-09T21:17:39","date_gmt":"2023-03-09T13:17:39","guid":{"rendered":"https:\/\/lolife.top\/?p=595"},"modified":"2023-03-09T21:17:40","modified_gmt":"2023-03-09T13:17:40","slug":"%e6%b4%9b%e8%b0%b7-p1429-%e5%b9%b3%e9%9d%a2%e6%9c%80%e8%bf%91%e7%82%b9%e5%af%b9%ef%bc%88%e5%8a%a0%e5%bc%ba%e7%89%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lolife.top\/?p=595","title":{"rendered":"\u6d1b\u8c37 P1429 \u5e73\u9762\u6700\u8fd1\u70b9\u5bf9\uff08\u52a0\u5f3a\u7248\uff09"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.luogu.com.cn\/problem\/P1429\">P1429 \u5e73\u9762\u6700\u8fd1\u70b9\u5bf9\uff08\u52a0\u5f3a\u7248\uff09 &#8211; \u6d1b\u8c37 | \u8ba1\u7b97\u673a\u79d1\u5b66\u6559\u80b2\u65b0\u751f\u6001 (luogu.com.cn)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u76ee\u80cc\u666f<\/h2>\n\n\n\n<p><a href=\"\/problem\/P7883\">P7883<\/a> \u5e73\u9762\u6700\u8fd1\u70b9\u5bf9\uff08\u52a0\u5f3a\u52a0\u5f3a\u7248\uff09<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9898\u76ee\u63cf\u8ff0<\/h2>\n\n\n\n<p>\u7ed9\u5b9a\u5e73\u9762\u4e0a n \u4e2a\u70b9\uff0c\u627e\u51fa\u5176\u4e2d\u7684\u4e00\u5bf9\u70b9\u7684\u8ddd\u79bb\uff0c\u4f7f\u5f97\u5728\u8fd9 n \u4e2a\u70b9\u7684\u6240\u6709\u70b9\u5bf9\u4e2d\uff0c\u8be5\u8ddd\u79bb\u4e3a\u6240\u6709\u70b9\u5bf9\u4e2d\u6700\u5c0f\u7684<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8f93\u5165\u683c\u5f0f<\/h2>\n\n\n\n<p>\u7b2c\u4e00\u884c\uff1an \uff0c\u4fdd\u8bc1 2&lt;=n&lt;=200000 \u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765 n \u884c\uff1a\u6bcf\u884c\u4e24\u4e2a\u5b9e\u6570\uff1ax y\uff0c\u8868\u793a\u4e00\u4e2a\u70b9\u7684\u884c\u5750\u6807\u548c\u5217\u5750\u6807\uff0c\u4e2d\u95f4\u7528\u4e00\u4e2a\u7a7a\u683c\u9694\u5f00\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8f93\u51fa\u683c\u5f0f<\/h2>\n\n\n\n<p>\u4ec5\u4e00\u884c\uff0c\u4e00\u4e2a\u5b9e\u6570\uff0c\u8868\u793a\u6700\u77ed\u8ddd\u79bb\uff0c\u7cbe\u786e\u5230\u5c0f\u6570\u70b9\u540e\u9762 4 \u4f4d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6837\u4f8b #1<\/h2>\n\n\n\n<p><strong>\u6837\u4f8b\u8f93\u5165 #1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>3\n1 1\n1 2\n2 2<\/code><\/pre>\n\n\n\n<p><strong>\u6837\u4f8b\u8f93\u51fa #1<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1.0000<\/code><\/pre>\n\n\n\n<p><strong>\u63d0\u793a<\/strong><\/p>\n\n\n\n<p>\u6570\u636e\u4fdd\u8bc1 0&lt;= x,y&lt;= 10^9<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def<\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u4e24\u4e2a\u8ddd\u79bb\u6bd4\u8f83\u8fd1\u7684\u70b9\u6765\u8bf4\uff0c\u4e24\u4e2a\u70b9\u4e0e\u539f\u70b9\u7684\u8ddd\u79bb\u4e00\u5b9a\u4e0d\u4f1a\u5dee\u592a\u591a\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u8be5\u70b9\u4e0e\u539f\u70b9\u7684\u8ddd\u79bb\u8fdb\u884c\u6392\u5e8f\uff0c\u6bcf\u6b21\u8ba1\u7b97\u4e24\u4e2a\u70b9\u7684\u8ddd\u79bb\u90fd\u53ea\u4ece\u8be5\u70b9\u5230\u8be5\u70b9\u5f80\u540e\u76845-10\u4e2a\u70b9\u8fdb\u884c\u8ba1\u7b97<\/p>\n\n\n\n<p>\u70b9\u4e0e\u539f\u70b9\u7684\u8ddd\u79bb\u4e3a\uff1ar=sqrt(x<sup>2<\/sup>+y<sup>2<\/sup>);sqrt()\u51fd\u6570\u4e00\u822c\u6548\u7387\u6bd4\u8f83\u5dee\uff0c\u7531\u4e8e\u6211\u4eec\u53ea\u662f\u7528\u4e8e\u6392\u5e8f\uff0c\u6240\u4ee5\u6211\u4eec\u76f4\u63a5\u7528r<sup>2<\/sup>\u5c31\u884c<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\r\n#include &lt;cmath>\r\n#include &lt;string>\r\n#include &lt;algorithm>\r\nusing namespace std;\r\nint n;\r\ndouble ans=1e15;\r\nstruct node\r\n{\r\n\tdouble x, y, r;\r\n\tnode()\r\n\t{\r\n\t\tx = 0;\r\n\t\ty = 0;\r\n\t\tr = 0;\r\n\t}\r\n}a&#91;200005];\r\nbool cmp(node a, node b)\r\n{\r\n\treturn a.r &lt; b.r;\r\n}\r\ndouble dis(node a, node b) {\r\n\treturn sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\/\/\u8ba1\u7b97\u4e24\u70b9\u4e4b\u95f4\u8ddd\u79bb \r\n}\r\nint main()\r\n{\r\n\tcin >> n;\r\n\tfor (int i=0;i&lt;n;i++)\r\n\t{\r\n\t\tcin >> a&#91;i].x >> a&#91;i].y;\r\n\t\ta&#91;i].r = a&#91;i].x * a&#91;i].x + a&#91;i].y * a&#91;i].y;\r\n\t}\r\n\tsort(a, a + n, cmp);\r\n\tfor (int i = 0; i &lt; n; i++)\r\n\t{\r\n\t\tfor (int j = 1; j &lt;= 5 &amp;&amp; i + j &lt; n; j++)\r\n\t\t{\r\n\t\t\tdouble t = dis(a&#91;i], a&#91;i + j]);\r\n\t\t\tans = min(ans, t);\r\n\t\t}\r\n\t}\r\n\tprintf(\"%.4lf\", ans);\r\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>P1429 \u5e73\u9762\u6700\u8fd1\u70b9\u5bf9\uff08\u52a0\u5f3a\u7248\uff09 &#8211; \u6d1b\u8c37 | \u8ba1\u7b97\u673a\u79d1\u5b66\u6559\u80b2\u65b0\u751f\u6001 (luogu.com.cn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,20],"tags":[19],"class_list":["post-595","post","type-post","status-publish","format-standard","hentry","category-c-c","category-20","tag-19"],"_links":{"self":[{"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/posts\/595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lolife.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=595"}],"version-history":[{"count":2,"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/posts\/595\/revisions"}],"predecessor-version":[{"id":597,"href":"https:\/\/lolife.top\/index.php?rest_route=\/wp\/v2\/posts\/595\/revisions\/597"}],"wp:attachment":[{"href":"https:\/\/lolife.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lolife.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lolife.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}