{"id":334,"date":"2010-08-05T21:59:00","date_gmt":"2010-08-05T13:59:00","guid":{"rendered":"http:\/\/localhost\/?p=334"},"modified":"2010-08-05T21:59:00","modified_gmt":"2010-08-05T13:59:00","slug":"srm_478_solution_","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=334","title":{"rendered":"SRM 478 Solution\u3002\u3002"},"content":{"rendered":"<p> \u54ce\u3002\u8fd9\u573a\u6781\u5ea6\u5931\u8d25\u7684SRM\u3002\u3002\u3002\u3002\u770b\u6765\u81ea\u5df1\u4e0d\u884c\u7684\u5730\u65b9\u8fd8\u6709\u5f88\u591a\u554a\u56e7\u3002\u3002\u3002<br \/>250\uff1a<br \/>\u6ce8\u610f\u5230\u6240\u6709\u7684\u53d8\u6362\u90fd\u662fx-&gt;2^n*x+2^n-1<br \/>\u8bbeF(a,x)=2^n*x+2^n-1,<br \/>\u90a3\u4e48\u53ef\u4ee5\u8bc1\u660eF(a,F(b,x))=F(a+b,x)..<br \/>\u7136\u540e\u53d8\u6362\u53ea\u6709a=2\u548ca=3.\u3002\u90a3\u4e48\u627e\u51fa\u6700\u5c0f\u7684t\u4f7f\u5f97F(t,x)%1000&#8230;007\u4e3a0.\u3002\u3002<br \/>\u7136\u540e\u628at\u8868\u793a\u62102\u548c3\u7684\u548c\u5c31OK\u4e86\u3002\u3002<br \/>\u60b2\u5267\u7684\u662f\u6211\u5fd8\u4e86\u8003\u8651\u4e00\u5f00\u59cb\u5c31\u53ef\u4ee5\u7684\u72b6\u6001\u4e86\u3002\u3002\u7136\u540e\u679c\u65ad\u88abCha\u3002\u30020\u5206\u3002\u3002<br \/>500\uff1a<br \/>\u4e5f\u5c31\u662f\u4e2a\u72b6\u6001\u538b\u7f29\u7684Dp\u6c57\u3002\u3002<br \/>\u8bbeAns[subset]\u4e3a\u628asubset\u7684\u90a3\u4e9b\u5f52\u5e76\u6210\u4e00\u5806\u53ef\u4ee5\u5f97\u5230\u7684\u94b1\uff0c<br \/>Dp[subset]subset\u90a3\u4e9b\u53ef\u4ee5\u5f97\u5230\u7684\u6700\u5927\u94b1<br \/>\u7136\u540e\u7a77\u4e3e\u4e00\u4e0b\u554asubset\u7684\u5b50\u96c6\u5c31\u53ef\u4ee5\u4e86\u3002\u3002<br \/>1000\uff1a<br \/>\u8bbesum\u4e3a\u6240\u6709\u7684\u53d6\u6cd5\u6570\uff0c<br \/>\u8003\u8651\u5148\u7b97\u51fap[i]=\u53d6\u7684\u65f6\u5019\u5728\u7b2ci\u4e2a\u76d2\u5b50\u91cc\u53d6\u7684\u6982\u7387\uff08\u5c31\u662f\u8fd9\u4e2a\u76d2\u5b50\u88ab\u9009\u4e2d\u4e86\u5e76\u4e14\u62bd\u4e2d\u4e86\u3002\u3002\uff09<br \/>\u6839\u636e\u8fd9\u4e2a\u5c31\u53ef\u4ee5\u7b97\u51fa\u5168\u90e8\u4e86\u3002\u3002<br \/>\u8bbe Dp[total]\u4e3a\u9009total\u4e2a\u82f9\u679c\u7684\u65b9\u6cd5\u603b\u6570\uff0cDp2[total]\u4e3a\u5ffd\u7565\u7b2ci\u4e2a\u76d2\u5b50\u8fd9\u6837\u7684\u65b9\u6cd5\u603b\u6570\uff0c<br \/>\u90a3\u4e48 with=Dp[total]-Dp2[total]\u5c31\u662f\u9009\u7b2ci\u4e2a\u76d2\u5b50\u8fd9\u6837\u7684\u65b9\u6cd5\u603b\u6570\uff0c<br \/>\u90a3\u4e48with\/sum*(Size[i]\/total)\u5c31\u662f\u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u6982\u7387\u3002\u3002<br \/>\u7136\u540e\u679a\u4e3etotal\u3002\u3002\u5168\u90e8+\u8d77\u6765\u5c31\u53ef\u4ee5\u641e\u51fap[i]\u4e86\u3002\u3002\u5c31OK\u4e86\u6c57\u3002\u3002<br \/>Size[i]\u662f\u7b2ci\u4e2a\u76d2\u5b50\u4e2d\u82f9\u679c\u603b\u6570<br \/>\u3002\u3002\u6211\u5c31\u662f\u4e00\u4e2a\u50bbX\u3002\u3002\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u54ce\u3002\u8fd9\u573a\u6781\u5ea6\u5931\u8d25\u7684SRM\u3002\u3002\u3002\u3002\u770b\u6765\u81ea\u5df1\u4e0d\u884c\u7684\u5730\u65b9\u8fd8\u6709\u5f88\u591a\u554a\u56e7\u3002\u3002\u3002250\uff1a\u6ce8\u610f\u5230\u6240\u6709\u7684\u53d8\u6362\u90fd\u662fx-&gt;2^n*x+2^n-1\u8bbeF(a,x)=2^n*x+2^n-1,\u90a3\u4e48\u53ef\u4ee5\u8bc1\u660eF(a,F(b,x))=F(a+b,x)..\u7136\u540e\u53d8\u6362\u53ea\u6709a=2\u548ca=3.\u3002\u90a3\u4e48\u627e\u51fa\u6700\u5c0f\u7684t\u4f7f\u5f97F(t,x)%1000&#8230;007\u4e3a0.\u3002\u3002\u7136\u540e\u628at\u8868\u793a\u62102\u548c3\u7684\u548c\u5c31OK\u4e86\u3002\u3002\u60b2\u5267\u7684\u662f\u6211\u5fd8\u4e86\u8003\u8651\u4e00\u5f00\u59cb\u5c31\u53ef\u4ee5\u7684\u72b6\u6001\u4e86\u3002\u3002\u7136\u540e\u679c\u65ad\u88abCha\u3002\u30020\u5206\u3002\u3002500\uff1a\u4e5f\u5c31\u662f\u4e2a\u72b6\u6001\u538b\u7f29\u7684Dp\u6c57\u3002\u3002\u8bbeAns[subset]\u4e3a\u628asubset\u7684\u90a3\u4e9b\u5f52\u5e76\u6210\u4e00\u5806\u53ef\u4ee5\u5f97\u5230\u7684\u94b1\uff0cDp[subset]subset\u90a3\u4e9b\u53ef\u4ee5\u5f97\u5230\u7684\u6700\u5927\u94b1\u7136\u540e\u7a77\u4e3e\u4e00\u4e0b\u554asubset\u7684\u5b50\u96c6\u5c31\u53ef\u4ee5\u4e86\u3002\u30021000\uff1a\u8bbesum\u4e3a\u6240\u6709\u7684\u53d6\u6cd5\u6570\uff0c\u8003\u8651\u5148\u7b97\u51fap[i]=\u53d6\u7684\u65f6\u5019\u5728\u7b2ci\u4e2a\u76d2\u5b50\u91cc\u53d6\u7684\u6982\u7387\uff08\u5c31\u662f\u8fd9\u4e2a\u76d2\u5b50\u88ab\u9009\u4e2d\u4e86\u5e76\u4e14\u62bd\u4e2d\u4e86\u3002\u3002\uff09\u6839\u636e\u8fd9\u4e2a\u5c31\u53ef\u4ee5\u7b97\u51fa\u5168\u90e8\u4e86\u3002\u3002\u8bbe Dp[total]\u4e3a\u9009total\u4e2a\u82f9\u679c\u7684\u65b9\u6cd5\u603b\u6570\uff0cDp2[total]\u4e3a\u5ffd\u7565\u7b2ci\u4e2a\u76d2\u5b50\u8fd9\u6837\u7684\u65b9\u6cd5\u603b\u6570\uff0c\u90a3\u4e48 with=Dp[total]-Dp2[total]\u5c31\u662f\u9009\u7b2ci\u4e2a\u76d2\u5b50\u8fd9\u6837\u7684\u65b9\u6cd5\u603b\u6570\uff0c\u90a3\u4e48with\/sum*(Size[i]\/total)\u5c31\u662f\u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u6982\u7387\u3002\u3002\u7136\u540e\u679a\u4e3etotal\u3002\u3002\u5168\u90e8+\u8d77\u6765\u5c31\u53ef\u4ee5\u641e\u51fap[i]\u4e86\u3002\u3002\u5c31OK\u4e86\u6c57\u3002\u3002Size[i]\u662f\u7b2ci\u4e2a\u76d2\u5b50\u4e2d\u82f9\u679c\u603b\u6570\u3002\u3002\u6211\u5c31\u662f\u4e00\u4e2a\u50bbX\u3002\u3002\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/334"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=334"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}