锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久亚洲?V成人无码,亚洲Av无码国产情品久久,久久精品久久久久观看99水蜜桃http://m.shnenglu.com/Yuan/category/16264.htmlzh-cnMon, 09 May 2011 08:41:22 GMTMon, 09 May 2011 08:41:22 GMT60CF76A 鎺掑簭闄嶇淮 鍔犺竟鎴愮幆鍒犳渶澶ц竟 鍒╃敤MST鎬ц川http://m.shnenglu.com/Yuan/archive/2011/05/05/145782.html_Yuan_YuanThu, 05 May 2011 15:36:00 GMThttp://m.shnenglu.com/Yuan/archive/2011/05/05/145782.htmlhttp://m.shnenglu.com/Yuan/comments/145782.htmlhttp://m.shnenglu.com/Yuan/archive/2011/05/05/145782.html#Feedback0http://m.shnenglu.com/Yuan/comments/commentRss/145782.htmlhttp://m.shnenglu.com/Yuan/services/trackbacks/145782.html闃呰鍏ㄦ枃

_Yuan 2011-05-05 23:36 鍙戣〃璇勮
]]>
CII 4057 鏋氫婦k涓?緙╁皬瑙勬ā 鈽呪槄鈽?/title><link>http://m.shnenglu.com/Yuan/archive/2011/03/28/142892.html</link><dc:creator>_Yuan</dc:creator><author>_Yuan</author><pubDate>Mon, 28 Mar 2011 13:39:00 GMT</pubDate><guid>http://m.shnenglu.com/Yuan/archive/2011/03/28/142892.html</guid><wfw:comment>http://m.shnenglu.com/Yuan/comments/142892.html</wfw:comment><comments>http://m.shnenglu.com/Yuan/archive/2011/03/28/142892.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/Yuan/comments/commentRss/142892.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/Yuan/services/trackbacks/142892.html</trackback:ping><description><![CDATA[<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img id=Codehighlighter1_0_669_Open_Image onclick="this.style.display='none'; Codehighlighter1_0_669_Open_Text.style.display='none'; Codehighlighter1_0_669_Closed_Image.style.display='inline'; Codehighlighter1_0_669_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_0_669_Closed_Image onclick="this.style.display='none'; Codehighlighter1_0_669_Closed_Text.style.display='none'; Codehighlighter1_0_669_Open_Image.style.display='inline'; Codehighlighter1_0_669_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_0_669_Closed_Text>/**/</span><span id=Codehighlighter1_0_669_Open_Text><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    緇欏畾涓涓猲 < 2^31<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鍦╗1,n]涓夊嚭涓浜涙暟錛屾瘡涓暟鍙互閫夊涓? 浣嗚姹備粬浠殑鍜屼負n<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鑰屼笖鍙敤榪欎簺鏁拌兘鍞竴琛ㄧず[1,n]涓墍鏈夌殑鏁?br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    濡俷 = 5錛?nbsp;鏈墈1,1,1,1,1} {1,2,2} , {1,1,3}<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鐪嬪埌n榪欎箞澶э紝搴旇鏄暟瀛︿箣綾葷殑鏂規硶鎴栬卨ogn錛宻qrt(n)涔嬬被鐨?br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鎯充笉鍑烘庝箞緙╁皬瑙勬ā -_,- <br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鐪嬭繖閲岀殑<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #008000; TEXT-DECORATION: underline">http://knol.google.com/k/wenlei-xie/acm-icpc-dhaka-2007-%E8%A7%A3%E9%A2%98%E6%8A%A5%E5%91%8A/15moho0gp59j7/3</span><span style="COLOR: #008000">#<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    棣栧厛蹇呴』鏈?錛岀劧鍚庢灇涓懼寘鍚玨涓?錛屽垯鑳借〃紺篬1,k]錛屽垯鎺ヤ笅鏉ョ殑鏁板氨鏄痥+1<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    濡傛灉鏈?涓猭+1錛屽垯[1,2k+1]閮借兘琚〃紺轟簡錛屾墍浠ヤ笅涓涓暟鍙兘鏄?(k+1)<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    濡傛灉鏈?涓猭+1錛屽垯[1,3k+2]閮借兘琚〃紺轟簡錛屾墍浠ヤ笅涓涓暟鍙兘鏄?(k+1)<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    <img src="http://m.shnenglu.com/Images/dot.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    浣嗘棤璁哄浣曪紝鎺ヤ笅鏉ョ殑鏁板彧鑳芥槸t(k+1)<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鎵浠ヨ繖涓泦鍚堬紝闄や簡k涓?涔嬪錛屽叾浠栨暟閮芥槸t(k+1) , t >=1<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鐢變簬闇瑕佸拰涓簄錛屾墍浠+1 | n-k<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鎵浠ョ瓟妗堜負錛歠(n) = 鈭慺((n-k)/(k+1)) = 鈭慺((n+1)/(k+1)-1)   k>=1, k+1 | n-k<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    杈圭晫涓篺(0) = 1<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鍥犳鍙互鏋氫婦n+1鐨勫洜瀛愶紝sqrt(n+1)鐨勫鏉傚害錛屾湁鐐規參<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鐢ㄤ釜map璁板綍涓嬬粨鏋?br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    浣嗚В棰樻姤鍛婇偅閲屾槸瀵筺鍒嗚В璐ㄥ洜瀛愪負∏pi^ai錛岀敤榪欑鏂規硶鍘繪灇涓懼洜瀛?br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    鍘勩傘傘傝繕娌¤瘯榪?nbsp;   <br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif"></span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstring</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">map</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">algorithm</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stack</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">queue</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cmath</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstdio</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">set</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">list</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">numeric</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cassert</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">ctime</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif">map</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> , </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> mp;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img id=Codehighlighter1_1030_1392_Open_Image onclick="this.style.display='none'; Codehighlighter1_1030_1392_Open_Text.style.display='none'; Codehighlighter1_1030_1392_Closed_Image.style.display='inline'; Codehighlighter1_1030_1392_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1030_1392_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1030_1392_Closed_Text.style.display='none'; Codehighlighter1_1030_1392_Open_Image.style.display='inline'; Codehighlighter1_1030_1392_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> solve(unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1030_1392_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1030_1392_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    map</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> , </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">::iterator it </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> mp.find(n);<br><img id=Codehighlighter1_1111_1135_Open_Image onclick="this.style.display='none'; Codehighlighter1_1111_1135_Open_Text.style.display='none'; Codehighlighter1_1111_1135_Closed_Image.style.display='inline'; Codehighlighter1_1111_1135_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1111_1135_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1111_1135_Closed_Text.style.display='none'; Codehighlighter1_1111_1135_Open_Image.style.display='inline'; Codehighlighter1_1111_1135_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (it </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> mp.end()) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1111_1135_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1111_1135_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> it</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">second;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000"> ans </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img id=Codehighlighter1_1209_1365_Open_Image onclick="this.style.display='none'; Codehighlighter1_1209_1365_Open_Text.style.display='none'; Codehighlighter1_1209_1365_Closed_Image.style.display='inline'; Codehighlighter1_1209_1365_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1209_1365_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1209_1365_Closed_Text.style.display='none'; Codehighlighter1_1209_1365_Open_Image.style.display='inline'; Codehighlighter1_1209_1365_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> k </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">; k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000"> (n</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) ; k</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1209_1365_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1209_1365_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_1237_1362_Open_Image onclick="this.style.display='none'; Codehighlighter1_1237_1362_Open_Text.style.display='none'; Codehighlighter1_1237_1362_Closed_Image.style.display='inline'; Codehighlighter1_1237_1362_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1237_1362_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1237_1362_Closed_Text.style.display='none'; Codehighlighter1_1237_1362_Open_Image.style.display='inline'; Codehighlighter1_1237_1362_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> ((n</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> (k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1237_1362_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1237_1362_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            ans </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> solve((n</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> kk </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (n</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img id=Codehighlighter1_1325_1358_Open_Image onclick="this.style.display='none'; Codehighlighter1_1325_1358_Open_Text.style.display='none'; Codehighlighter1_1325_1358_Closed_Image.style.display='inline'; Codehighlighter1_1325_1358_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1325_1358_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1325_1358_Closed_Text.style.display='none'; Codehighlighter1_1325_1358_Open_Image.style.display='inline'; Codehighlighter1_1325_1358_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (kk </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1325_1358_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1325_1358_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">                ans </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> solve(k);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">k+1-1</span><span style="COLOR: #008000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif"></span><span style="COLOR: #000000">            }</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">        }</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> mp[n] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ans </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br><img id=Codehighlighter1_1406_1620_Open_Image onclick="this.style.display='none'; Codehighlighter1_1406_1620_Open_Text.style.display='none'; Codehighlighter1_1406_1620_Closed_Image.style.display='inline'; Codehighlighter1_1406_1620_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1406_1620_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1406_1620_Closed_Text.style.display='none'; Codehighlighter1_1406_1620_Open_Image.style.display='inline'; Codehighlighter1_1406_1620_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1406_1620_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1406_1620_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">#ifndef ONLINE_JUDGE<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">freopen("in","r",stdin);</span><span style="COLOR: #008000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    mp[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> T, t </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img id=Codehighlighter1_1522_1607_Open_Image onclick="this.style.display='none'; Codehighlighter1_1522_1607_Open_Text.style.display='none'; Codehighlighter1_1522_1607_Closed_Image.style.display='inline'; Codehighlighter1_1522_1607_Closed_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1522_1607_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1522_1607_Closed_Text.style.display='none'; Codehighlighter1_1522_1607_Open_Image.style.display='inline'; Codehighlighter1_1522_1607_Open_Text.style.display='inline';" align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">T); T</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000"> ;) </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1522_1607_Closed_Text><img src="http://m.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1522_1607_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        unsigned </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%u</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">n);<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Case %d: %lld\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, t</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">, solve(n));<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://m.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span></div> <img src ="http://m.shnenglu.com/Yuan/aggbug/142892.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/Yuan/" target="_blank">_Yuan</a> 2011-03-28 21:39 <a href="http://m.shnenglu.com/Yuan/archive/2011/03/28/142892.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Poj 2728 鏈浼樻瘮鐜囩敓鎴愭爲http://m.shnenglu.com/Yuan/archive/2010/04/15/112720.html_Yuan_YuanThu, 15 Apr 2010 14:48:00 GMThttp://m.shnenglu.com/Yuan/archive/2010/04/15/112720.htmlhttp://m.shnenglu.com/Yuan/comments/112720.htmlhttp://m.shnenglu.com/Yuan/archive/2010/04/15/112720.html#Feedback0http://m.shnenglu.com/Yuan/comments/commentRss/112720.htmlhttp://m.shnenglu.com/Yuan/services/trackbacks/112720.html/*
    鐩爣:min{鈭慶osti/鈭憀eni}
    閫艱繎鐨勬濇兂錛屸垜costi/鈭憀eni<=x錛屽嵆 鈭?costi-x*leni)<=0    鏄竴涓崟璋冮掑噺鍑芥暟
    鍗蟲眰杈逛負costi-x*leni鐨?nbsp;MST
    鍙互鐢ㄤ簩鍒嗭紝浣嗘瘮杈冩參
    鐢ㄨ凱浠e揩濂藉
*/

#include
<cstdio>
#include
<cstring>
#include
<algorithm>
#include
<cmath>
#include
<cstdlib>
using namespace std;

const double esp=0.00001;
const int MAXN=1010;
const double DINF=1000000000.0;

struct Point{
    
int x,y,z;
}
points[MAXN];

int N;
bool vi[MAXN];
double dist[MAXN];
int pre[MAXN];

double cal(int a,int b){
    
return sqrt(1.*(points[a].x-points[b].x)*(points[a].x-points[b].x)+
            
1.*(points[a].y-points[b].y)*(points[a].y-points[b].y));
}


double prim(double x){
    memset(vi,
0,sizeof(vi));
    
for(int i=2;i<=N;i++){
        dist[i]
=abs(points[1].z-points[i].z)-cal(1,i)*x;
        pre[i]
=1;
    }

    dist[
1]=0;vi[1]=1;
    
double cost=0,len=0;
    
for(int i=1;i<N;i++){
        
double Min=DINF;
        
int u;
        
for(int j=2;j<=N;j++)
            
if(!vi[j]&&Min>dist[j]){
                Min
=dist[j];
                u
=j;
            }

        vi[u]
=1;
        cost
+=abs(points[pre[u]].z-points[u].z);
        len
+=cal(pre[u],u);
        
for(int j=2;j<=N;j++){
            
double val=abs(points[u].z-points[j].z)-cal(u,j)*x;
            
if(!vi[j]&&dist[j]>val){
                dist[j]
=val;
                pre[j]
=u;
            }

       }

    }

    
return cost/len;
}

int main(){
    
while(scanf("%d",&N),N){
        
for(int i=1;i<=N;i++)
            scanf(
"%d%d%d",&points[i].x,&points[i].y,&points[i].z);
        
//鍒嗘暟瑙勫垝鐢細Dinkelbach綆楁硶
        
//姣忔榪唬瀛愰棶棰樼殑瑙ost`/len`榪涘幓錛岃繖鏍蜂細涓嶆柇閫艱繎鏈浼樿В
        double a=0,b;
        
while(1){
            b
=prim(a);
            
if(fabs(b-a)<esp)break;
            a
=b;
        }

        printf(
"%.3f\n",b);
    }

    
return 0;
}


/*
        //cost-len*x<=0
        double low=0,high=100.0;             //鍏跺疄浜屽垎20澶氭宸茬粡寰堣凍澶熶簡
        while(high-low>esp){
            double mid=(low+high)/2;
            if(prim(mid))high=mid;
            else low=mid;
        }
        printf("%.3f\n",high);

*/


_Yuan 2010-04-15 22:48 鍙戣〃璇勮
]]>
ZOJ 3280 Choose The Best http://m.shnenglu.com/Yuan/archive/2010/03/18/109998.html_Yuan_YuanThu, 18 Mar 2010 07:18:00 GMThttp://m.shnenglu.com/Yuan/archive/2010/03/18/109998.htmlhttp://m.shnenglu.com/Yuan/comments/109998.htmlhttp://m.shnenglu.com/Yuan/archive/2010/03/18/109998.html#Feedback0http://m.shnenglu.com/Yuan/comments/commentRss/109998.htmlhttp://m.shnenglu.com/Yuan/services/trackbacks/109998.html      鎴戣繕鏄妱瑙i鎶ュ憡鐨勶紝鎰熻鎯蟲硶寰堝

      http://blog.sina.com.cn/s/blog_5123df350100h3bu.html

           
/*
    棰樼洰澶ф剰錛氱粰瀹歂緇寸┖闂寸殑涓浜涚偣錛屾眰鍔犳潈鏇煎搱欏胯窛紱繪渶榪戠殑涓や釜鐐圭殑璺濈銆?br>    鍒嗘瀽錛?nbsp;鏉冨煎彲浠ヤ箻鍒扮偣鍧愭爣涓婂幓錛屽氨鏄鍙互鎶婃瘡涓偣姣忎竴緇撮兘涔樹笂瀵瑰簲鐨剋[t]銆?br>    鑰冭檻2緇寸殑鎯呭喌 |x1-x2|+|y1-y2| 鏈澶у煎彧鏈?縐嶆儏鍐碉細
    (x1+y1)-(x2+y2) , (-x1+y1)-(-x2+y2), (-x1-y1)-(-x2-y2), (x1-y1)-(x2-y2)錛?br>    鏈澶у兼槸4縐嶄箣涓錛岃繖閲岄潰鍙栨渶澶у氨鍙互浜嗐?br>    灝戒竴姝ョ湅鍒?縐嶅艦寮忥紝姣忕鑷韓絎竴涓偣鍜岀浜屼釜鐐瑰潗鏍囬棿鍔犳璐熷彿鐨勬柟娉曟槸涓鏍風殑銆?br>    鎺ㄥ箍鍒癗緇達紝鎴戜滑鏋氫婦鍔犵鍙風殑鏂瑰紡錛屼竴鍏憋紙1<<M錛夌錛岀劧鍚庡姣忕鏂瑰紡錛?br>    姣忎釜鐐圭殑鍧愭爣鎸夋灇涓劇殑鍔犳嫭鍙風殑鏂瑰紡N緇磋繍綆楁眰鍑轟竴涓兼潵錛屽彇鏈澶у拰鏈灝忓肩殑宸紝
    浣滀負鍙兘緇撴灉錛屾渶鍚庡彇鎵鏈夊樊鍊間腑鏈澶х殑鍗沖彲銆傦紙娉ㄦ剰M寰堝皬錛屽彧鏈?錛夊鏉傚害O(2M*n)
*/

#include
<cstdio>
#include
<cstring>
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)

const int MAXN=50001;
const int M=9;
const int inf=1000000000;

int cb[MAXN][M],w[M];
int n,m;

int main(){
    
while(~scanf("%d%d",&n,&m)){

        
for(int i=1;i<=n;i++)
            
for(int j=1;j<=m;j++)
                scanf(
"%d",&cb[i][j]);
        
for(int j=1;j<=m;j++)
            scanf(
"%d",&w[j]);

        
int limit=1<<m,ans=0;
        
for(int k=0;k<limit;k++){
            
int Max=-inf,Min=inf;
            
for(int i=1;i<=n;i++){
                
int tmp=0;
                
for(int t=0;t<m;t++){
                    
if(k&(1<<t))tmp+=w[t+1]*cb[i][t+1];
                    
else tmp-=w[t+1]*cb[i][t+1];
                }

                Max
=max(tmp,Max);
                Min
=min(tmp,Min);
            }

            ans
=max(ans,Max-Min);
        }

        printf(
"%d\n",ans);
    }

    
return 0;
}




_Yuan 2010-03-18 15:18 鍙戣〃璇勮
]]>
99蜜桃臀久久久欧美精品网站| 久久国产免费观看精品| 伊人伊成久久人综合网777| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 亚洲av伊人久久综合密臀性色| 亚洲精品无码久久千人斩| 久久久久高潮毛片免费全部播放 | 久久精品人成免费| 老司机国内精品久久久久| 日韩中文久久| 久久er热视频在这里精品| 久久综合伊人77777| 国产精品岛国久久久久| 波多野结衣久久一区二区 | 久久美女网站免费| 久久久久亚洲AV无码观看| 国产精品18久久久久久vr | 国产成人无码久久久精品一| 久久久久99精品成人片三人毛片| 伊人色综合久久天天人手人婷 | 一本久道久久综合狠狠爱| 国产AV影片久久久久久| 久久精品中文无码资源站 | 中文字幕乱码久久午夜| 久久本道久久综合伊人| 777米奇久久最新地址| 亚洲国产精品无码久久一区二区| 激情五月综合综合久久69| a高清免费毛片久久| 久久超乳爆乳中文字幕| 日本强好片久久久久久AAA | 国产日产久久高清欧美一区| 狼狼综合久久久久综合网| 18禁黄久久久AAA片| 中文字幕久久亚洲一区| 久久久精品视频免费观看| 国产AV影片久久久久久| 久久精品国产清自在天天线| 久久av免费天堂小草播放| 国产无套内射久久久国产| 国内精品久久久久久久涩爱 |