{"id":858,"date":"2019-04-09T21:43:39","date_gmt":"2019-04-09T13:43:39","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=858"},"modified":"2019-04-09T21:46:40","modified_gmt":"2019-04-09T13:46:40","slug":"lp1337-jsoi2004-%e5%b9%b3%e8%a1%a1%e7%82%b9-or-%e5%90%8a%e6%89%93xxx","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2019\/04\/09\/lp1337-jsoi2004-%e5%b9%b3%e8%a1%a1%e7%82%b9-or-%e5%90%8a%e6%89%93xxx\/","title":{"rendered":"lp1337 JSOI2004 \u5e73\u8861\u70b9 or \u540a\u6253XXX"},"content":{"rendered":"\n<p>\u9996\u5148\u6211\u4eec\u8ba4\u8bc6\u4e00\u79cd\u7b97\u6cd5\u2014\u2014\u722c\u5c71\u7b97\u6cd5\u3002\u8fd9\u79cd\u7b97\u6cd5\u603b\u662f\u8d2a\u5fc3\u5730\u63a5\u53d7\u66f4\u4f18\u79c0\u7684\u89e3\u3002<br>\n\u4f46\u662f\uff0c\u6211\u4eec\u77e5\u9053\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u89e3\u90fd\u662f\u4e00\u4e2a\u5355\u5cf0\u51fd\u6570\u3002\u56e0\u6b64\u6211\u4eec\u6709\u4e86\u975e\u5e38\u5177\u6709\u9b54\u529b\u7684\u6a21\u62df\u9000\u706b\u7b97\u6cd5\u3002<br>\n\u6211\u4eec\u60f3\u5230\u4e00\u79cd\u968f\u673a\u5316\u7684\u4f18\u5316\u65b9\u6848\uff0c\u5c31\u662f\u5bf9\u4e8e\u4e00\u4e2a\u65b0\u7684\u89e3\uff0c\u5982\u679c\u662f\u66f4\u4f18\u7684\uff0c\u5c31\u4e00\u5b9a\u63a5\u53d7\u5b83\uff1b\u5426\u5219\uff0c\u6709\u6982\u7387\u53bb\u63a5\u53d7\u5b83\u3002<br>\n\u7136\u800c\u8fd9\u6837\u5e76\u4e0d\u662f\u7279\u522b\u4f18\u7684\uff0c\u56e0\u4e3a\u5982\u679c\u6982\u7387\u56fa\u5b9a\uff0c\u90a3\u4e48\u5b83\u5f88\u5927\u610f\u4e49\u4e0a\u8fd8\u662f\u5728\u778eJB\u8df3\u3002\u6211\u4eec\u6709\u4e00\u79cd\u88ab\u79f0\u4e3a\u300c\u6a21\u62df\u9000\u706b\u300d\u7684\u7b97\u6cd5\u3002\u6211\u4eec\u5b9a\u4e49\u4e00\u4e2a\u5168\u5c40\u53d8\u91cfT\uff0c\u4ee4\u778eJB\u8df3\u7684\u6982\u7387\u662f\\(e^{\\frac{\\Delta ans}{T}}\\)\uff0c\u7136\u540e\u6211\u4eec\u4ee4\\(T\\)\u4e0d\u65ad\u964d\u4f4e\uff0c\u4f7f\u5f97\u6700\u540e\u7684\u7b54\u6848\u8d8b\u4e8e\u7a33\u5b9a\u3002<br>\n\u6211\u4eec\u76f8\u4fe1\uff0c\u53ea\u8981T\u8db3\u591f\u5927\u3001\u5c1d\u8bd5\u7684\u6b21\u6570\u8db3\u591f\u591a\uff0c\u90a3\u4e48\u603b\u662f\u80fd\u627e\u5230\u6700\u4f18\u89e3\u3002<br>\n\u7136\u800c\uff0c\u6211\u4eec\u5fc5\u987b\u660e\u767d\u7684\u662f\uff0c\u6a21\u62df\u9000\u706b\u672c\u8d28\u4e0a\u662f\u4e00\u79cd\u4ee5\u65f6\u95f4\u6362\u6b63\u786e\u6027\u7684\u7b97\u6cd5\uff0c\u56e0\u6b64\u8981\u5982\u4f55\u5728\u65f6\u95f4\u548c\u6b63\u786e\u6027\u4e4b\u95f4\u53d6\u5f97\u5e73\u8861\uff0c\u5c31\u6210\u4e3a\u4e00\u4e2a\u5f88\u56f0\u96be\u7684\u95ee\u9898\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cstring>\n#include&lt;algorithm>\n#include&lt;queue>\n#include&lt;vector>\n#include&lt;cmath>\n#include&lt;cstdlib>\n#include&lt;ctime>\n#define RD() (T*(rand()*2-RAND_MAX))\nusing namespace std;\n\ntypedef double db;\ntypedef long double ldb;\nconst int N=1005;\nconst ldb dlT=0.97;\nconst ldb eps=1E-14;\ndb x[N],y[N],w[N];\nint n;\ninline ldb calc(db X,db Y){\n\tdb dx,dy,rt=0;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tdx=x[i]-X,dy=y[i]-Y;\n\t\trt+=sqrt(dx*dx+dy*dy)*w[i];\n\t}\n\treturn rt;\n}\nvoid init(){\n\tscanf(\"%d\",&amp;n);\n\tdb smx=0,smy=0;\n\tint tms=100;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tscanf(\"%lf%lf%lf\",x+i,y+i,w+i);\n\t\tsmx+=x[i],smy+=y[i];\n\t}\n\tsmx\/=n,smy\/=n;\n\tdb ans,bst,x0,y0,x1,y1,nw;\n\tans=bst=calc(smx,smy);\n\tsrand(time(0));\n\twhile(tms--){\n\t\tans=bst,x0=smx,y0=smy;\n\t\tfor(db T=100000;T>eps;T*=dlT){\n\t\t\tx1=x0+RD(),y1=y0+RD();\n\t\t\tnw=calc(x1,y1);\n\/\/\t\t\tprintf(\"%lf %lf\\n\",x1,y1);\n\t\t\tif(nw&lt;bst){\n\t\t\t\tbst=nw;\n\t\t\t\tsmx=x1,smy=y1;\n\t\t\t}\n\t\t\tif(nw&lt;ans||(exp((ans-nw)\/T)>(long double)rand()\/RAND_MAX)){\n\t\t\t\tans=nw;\n\t\t\t\tx0=x1,y0=y1;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%.3lf %.3lf\\n\",smx,smy);\n}\nint main(){\n\tinit();\n\treturn 0;\n}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u6211\u4eec\u8ba4\u8bc6\u4e00\u79cd\u7b97\u6cd5\u2014\u2014\u722c\u5c71\u7b97\u6cd5\u3002\u8fd9\u79cd\u7b97\u6cd5\u603b\u662f\u8d2a\u5fc3\u5730\u63a5\u53d7\u66f4\u4f18\u79c0\u7684\u89e3\u3002 \u4f46\u662f\uff0c\u6211\u4eec\u77e5\u9053\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u89e3\u90fd\u662f\u4e00\u4e2a\u5355 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2019\/04\/09\/lp1337-jsoi2004-%e5%b9%b3%e8%a1%a1%e7%82%b9-or-%e5%90%8a%e6%89%93xxx\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201clp1337 JSOI2004 \u5e73\u8861\u70b9 or \u540a\u6253XXX\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[109,8,9,6,108,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/858"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=858"}],"version-history":[{"count":2,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/858\/revisions"}],"predecessor-version":[{"id":860,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/858\/revisions\/860"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=858"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}