﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-acmercyj-文章分类-动态规划</title><link>http://www.cppblog.com/acmercyj/category/16564.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 20 May 2011 15:58:55 GMT</lastBuildDate><pubDate>Fri, 20 May 2011 15:58:55 GMT</pubDate><ttl>60</ttl><item><title>hdu1881 贪心+动态规划</title><link>http://www.cppblog.com/acmercyj/articles/146680.html</link><dc:creator>mr_chen</dc:creator><author>mr_chen</author><pubDate>Wed, 18 May 2011 09:39:00 GMT</pubDate><guid>http://www.cppblog.com/acmercyj/articles/146680.html</guid><wfw:comment>http://www.cppblog.com/acmercyj/comments/146680.html</wfw:comment><comments>http://www.cppblog.com/acmercyj/articles/146680.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acmercyj/comments/commentRss/146680.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acmercyj/services/trackbacks/146680.html</trackback:ping><description><![CDATA[按照发起人离开的时间从小到大排序，然后就是一个0-1背包问题，要注意的是活动持续时间小于j<br /><br /><br />
<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"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #000000">#pragma&nbsp;warning(disable&nbsp;:&nbsp;</span><span style="color: #000000">4786</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #000000">iostream</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">string</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #000000">cstring</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">algorithm</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #000000">vector</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">using</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">namespace</span><span style="color: #000000">&nbsp;std;<br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">struct</span><span style="color: #000000">&nbsp;load&nbsp;<br /></span><span style="color: #008080">10</span><span style="color: #000000"><img id="Codehighlighter1_159_185_Open_Image" onclick="this.style.display='none'; Codehighlighter1_159_185_Open_Text.style.display='none'; Codehighlighter1_159_185_Closed_Image.style.display='inline'; Codehighlighter1_159_185_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_159_185_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_159_185_Closed_Text.style.display='none'; Codehighlighter1_159_185_Open_Image.style.display='inline'; Codehighlighter1_159_185_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.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_159_185_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_159_185_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;h;<br /></span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;l;<br /></span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;t;<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000">;<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />load&nbsp;souc[</span><span style="color: #000000">31</span><span style="color: #000000">];<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">bool</span><span style="color: #000000">&nbsp;cmp(</span><span style="color: #0000ff">const</span><span style="color: #000000">&nbsp;load&nbsp;</span><span style="color: #000000">&amp;</span><span style="color: #000000">a,</span><span style="color: #0000ff">const</span><span style="color: #000000">&nbsp;load&nbsp;</span><span style="color: #000000">&amp;</span><span style="color: #000000">b)<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img id="Codehighlighter1_241_262_Open_Image" onclick="this.style.display='none'; Codehighlighter1_241_262_Open_Text.style.display='none'; Codehighlighter1_241_262_Closed_Image.style.display='inline'; Codehighlighter1_241_262_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_241_262_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_241_262_Closed_Text.style.display='none'; Codehighlighter1_241_262_Open_Image.style.display='inline'; Codehighlighter1_241_262_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.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_241_262_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_241_262_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;a.t&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #000000">&nbsp;b.t;<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;main()<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_275_860_Open_Image" onclick="this.style.display='none'; Codehighlighter1_275_860_Open_Text.style.display='none'; Codehighlighter1_275_860_Closed_Image.style.display='inline'; Codehighlighter1_275_860_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_275_860_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_275_860_Closed_Text.style.display='none'; Codehighlighter1_275_860_Open_Image.style.display='inline'; Codehighlighter1_275_860_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.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_275_860_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_275_860_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">22</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;n;<br /></span><span style="color: #008080">23</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;i,j;<br /></span><span style="color: #008080">24</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;maxv;<br /></span><span style="color: #008080">25</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">while</span><span style="color: #000000">&nbsp;(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">&amp;</span><span style="color: #000000">n)</span><span style="color: #000000">==</span><span style="color: #000000">1</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">&nbsp;n</span><span style="color: #000000">&gt;</span><span style="color: #000000">0</span><span style="color: #000000">)<br /></span><span style="color: #008080">26</span><span style="color: #000000"><img id="Codehighlighter1_344_844_Open_Image" onclick="this.style.display='none'; Codehighlighter1_344_844_Open_Text.style.display='none'; Codehighlighter1_344_844_Closed_Image.style.display='inline'; Codehighlighter1_344_844_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_344_844_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_344_844_Closed_Text.style.display='none'; Codehighlighter1_344_844_Open_Image.style.display='inline'; Codehighlighter1_344_844_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</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_344_844_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_344_844_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">27</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vector&nbsp;</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;f;<br /></span><span style="color: #008080">28</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxv</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">29</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">&nbsp;(i</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000">&lt;</span><span style="color: #000000">n;</span><span style="color: #000000">++</span><span style="color: #000000">i)<br /></span><span style="color: #008080">30</span><span style="color: #000000"><img id="Codehighlighter1_396_510_Open_Image" onclick="this.style.display='none'; Codehighlighter1_396_510_Open_Text.style.display='none'; Codehighlighter1_396_510_Closed_Image.style.display='inline'; Codehighlighter1_396_510_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_396_510_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_396_510_Closed_Text.style.display='none'; Codehighlighter1_396_510_Open_Image.style.display='inline'; Codehighlighter1_396_510_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_396_510_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_396_510_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">31</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000">"</span><span style="color: #000000">%d%d%d</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">&amp;</span><span style="color: #000000">souc[i].h,</span><span style="color: #000000">&amp;</span><span style="color: #000000">souc[i].l,</span><span style="color: #000000">&amp;</span><span style="color: #000000">souc[i].t);<br /></span><span style="color: #008080">32</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(souc[i].t&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;maxv)<br /></span><span style="color: #008080">33</span><span style="color: #000000"><img id="Codehighlighter1_479_506_Open_Image" onclick="this.style.display='none'; Codehighlighter1_479_506_Open_Text.style.display='none'; Codehighlighter1_479_506_Closed_Image.style.display='inline'; Codehighlighter1_479_506_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_479_506_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_479_506_Closed_Text.style.display='none'; Codehighlighter1_479_506_Open_Image.style.display='inline'; Codehighlighter1_479_506_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_479_506_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_479_506_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">34</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxv&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;souc[i].t;<br /></span><span style="color: #008080">35</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">36</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">37</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sort(souc,souc</span><span style="color: #000000">+</span><span style="color: #000000">n,cmp);<br /></span><span style="color: #008080">38</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.resize(maxv</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">);<br /></span><span style="color: #008080">39</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fill(f.begin(),f.end(),</span><span style="color: #000000">0</span><span style="color: #000000">);<br /></span><span style="color: #008080">40</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;t</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">41</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">&nbsp;(i</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000">&lt;</span><span style="color: #000000">n;</span><span style="color: #000000">++</span><span style="color: #000000">i)<br /></span><span style="color: #008080">42</span><span style="color: #000000"><img id="Codehighlighter1_619_824_Open_Image" onclick="this.style.display='none'; Codehighlighter1_619_824_Open_Text.style.display='none'; Codehighlighter1_619_824_Closed_Image.style.display='inline'; Codehighlighter1_619_824_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_619_824_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_619_824_Closed_Text.style.display='none'; Codehighlighter1_619_824_Open_Image.style.display='inline'; Codehighlighter1_619_824_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_619_824_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_619_824_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">43</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">&nbsp;(j</span><span style="color: #000000">=</span><span style="color: #000000">maxv;j</span><span style="color: #000000">&gt;=</span><span style="color: #000000">souc[i].l;</span><span style="color: #000000">--</span><span style="color: #000000">j)<br /></span><span style="color: #008080">44</span><span style="color: #000000"><img id="Codehighlighter1_657_820_Open_Image" onclick="this.style.display='none'; Codehighlighter1_657_820_Open_Text.style.display='none'; Codehighlighter1_657_820_Closed_Image.style.display='inline'; Codehighlighter1_657_820_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_657_820_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_657_820_Closed_Text.style.display='none'; Codehighlighter1_657_820_Open_Image.style.display='inline'; Codehighlighter1_657_820_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_657_820_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_657_820_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">45</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(souc[i].t&nbsp;</span><span style="color: #000000">&gt;=</span><span style="color: #000000">&nbsp;j)<br /></span><span style="color: #008080">46</span><span style="color: #000000"><img id="Codehighlighter1_687_815_Open_Image" onclick="this.style.display='none'; Codehighlighter1_687_815_Open_Text.style.display='none'; Codehighlighter1_687_815_Closed_Image.style.display='inline'; Codehighlighter1_687_815_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_687_815_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_687_815_Closed_Text.style.display='none'; Codehighlighter1_687_815_Open_Image.style.display='inline'; Codehighlighter1_687_815_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_687_815_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_687_815_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">47</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f[j]&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;f[j]</span><span style="color: #000000">&gt;</span><span style="color: #000000">f[j</span><span style="color: #000000">-</span><span style="color: #000000">souc[i].l]</span><span style="color: #000000">+</span><span style="color: #000000">souc[i].h</span><span style="color: #000000">?</span><span style="color: #000000">f[j]:f[j</span><span style="color: #000000">-</span><span style="color: #000000">souc[i].l]</span><span style="color: #000000">+</span><span style="color: #000000">souc[i].h;<br /></span><span style="color: #008080">48</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(f[j]&nbsp;</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;t)<br /></span><span style="color: #008080">49</span><span style="color: #000000"><img id="Codehighlighter1_786_809_Open_Image" onclick="this.style.display='none'; Codehighlighter1_786_809_Open_Text.style.display='none'; Codehighlighter1_786_809_Closed_Image.style.display='inline'; Codehighlighter1_786_809_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_786_809_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_786_809_Closed_Text.style.display='none'; Codehighlighter1_786_809_Open_Image.style.display='inline'; Codehighlighter1_786_809_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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_786_809_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_786_809_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">50</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;f[j];<br /></span><span style="color: #008080">51</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">52</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">53</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">54</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">55</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">t</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">endl;<br /></span><span style="color: #008080">56</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">57</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">58</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">59</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span></div><img src ="http://www.cppblog.com/acmercyj/aggbug/146680.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acmercyj/" target="_blank">mr_chen</a> 2011-05-18 17:39 <a href="http://www.cppblog.com/acmercyj/articles/146680.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>