﻿<?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++博客-algorithm-文章分类-dynamic Programm</title><link>http://www.cppblog.com/vvilp/category/10774.html</link><description>目前最痛苦的事 就是 做不出第二题！！！！！
第三题 OMFG！！！！！</description><language>zh-cn</language><lastBuildDate>Wed, 03 Jun 2009 09:37:07 GMT</lastBuildDate><pubDate>Wed, 03 Jun 2009 09:37:07 GMT</pubDate><ttl>60</ttl><item><title>srm150---- 500 StripePainter</title><link>http://www.cppblog.com/vvilp/articles/86658.html</link><dc:creator>wZt</dc:creator><author>wZt</author><pubDate>Wed, 03 Jun 2009 07:48:00 GMT</pubDate><guid>http://www.cppblog.com/vvilp/articles/86658.html</guid><wfw:comment>http://www.cppblog.com/vvilp/comments/86658.html</wfw:comment><comments>http://www.cppblog.com/vvilp/articles/86658.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/vvilp/comments/commentRss/86658.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/vvilp/services/trackbacks/86658.html</trackback:ping><description><![CDATA[<p>Karel is a frustrated painter who works by day in an electrical repair<br>shop.&nbsp; Inspired by the color-coded bands on resistors, he is painting<br>a series of long, narrow canvases with bold colored stripes.&nbsp; However, <br>Karel is lazy and wants to minimize the number of brush strokes it takes <br>to paint each canvas.</p>
<p>&nbsp;</p>
<p>Abbreviating each color to a single uppercase letter, Karel would<br>write the stripe pattern red-green-blue-green-red as "RGBGR" <br>(quotes added for clarity).&nbsp; It would take him three brush strokes to<br>paint this pattern.<br>The first stroke would cover the entire canvas in red (RRRRR).<br>The second stroke would leave a band of red on either side and fill<br>in the rest with green (RGGGR).<br>The final brush stroke would fill in the blue stripe in the center<br>(RGBGR).</p>
<p>&nbsp;</p>
<p>Given a stripe pattern stripes as a String, calculate the minimum number of<br>brush strokes required to paint that pattern.</p>
<p><br>DEFINITION<br>Class:StripePainter<br>Method:minStrokes<br>Parameters:String<br>Returns:int<br>Method signature:int minStrokes(String stripes)</p>
<p><br>NOTES<br>-The blank canvas is an ugly color and must not show through.</p>
<p><br>CONSTRAINTS<br>-stripes will contain only uppercase letters ('A'-'Z', inclusive).<br>-stripes will contain between 1 and 50 characters, inclusive.</p>
<p><br>EXAMPLES</p>
<p>0)<br>"RGBGR"</p>
<p>Returns: 3</p>
<p>Example from introduction.</p>
<p>1)<br>"RGRG"</p>
<p>Returns: 3</p>
<p>This example cannot be done in two strokes, even though there are only two colors.<br>Suppose you tried to paint both red stripes in one stroke, followed by both green stripes <br>in one stroke.&nbsp; Then the green stroke would cover up the second red stripe.&nbsp; If you tried<br>to paint both green stripes first, followed the red stripes, then the red stroke would<br>cover up the first green stripe.</p>
<p>2)<br>"ABACADA"</p>
<p>Returns: 4</p>
<p>One long stroke in color 'A', followed by one stroke each in colors 'B', 'C', and 'D'.</p>
<p>3)<br>"AABBCCDD CCBB AABBCCDD"</p>
<p>Returns: 7</p>
<p>4)<br>"BECBBDDEEBABDCADEAAEABCACBDBEECDEDEACACCBEDABEDADD"</p>
<p>Returns: 26<br><br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id=Codehighlighter1_20_615_Open_Image onclick="this.style.display='none'; Codehighlighter1_20_615_Open_Text.style.display='none'; Codehighlighter1_20_615_Closed_Image.style.display='inline'; Codehighlighter1_20_615_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_20_615_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_20_615_Closed_Text.style.display='none'; Codehighlighter1_20_615_Open_Image.style.display='inline'; Codehighlighter1_20_615_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;StripePainter&nbsp;</span><span id=Codehighlighter1_20_615_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_20_615_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[][]&nbsp;dp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">dp[i][j]&nbsp;表示从i-j的范围内&nbsp;最小的涂色次数</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_121_613_Open_Image onclick="this.style.display='none'; Codehighlighter1_121_613_Open_Text.style.display='none'; Codehighlighter1_121_613_Closed_Image.style.display='inline'; Codehighlighter1_121_613_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_121_613_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_121_613_Closed_Text.style.display='none'; Codehighlighter1_121_613_Open_Image.style.display='inline'; Codehighlighter1_121_613_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;minStrokes(String&nbsp;s)&nbsp;</span><span id=Codehighlighter1_121_613_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_121_613_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;res&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[s.length()][s.length()];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;s.length();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_227_248_Open_Image onclick="this.style.display='none'; Codehighlighter1_227_248_Open_Text.style.display='none'; Codehighlighter1_227_248_Closed_Image.style.display='inline'; Codehighlighter1_227_248_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_227_248_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_227_248_Closed_Text.style.display='none'; Codehighlighter1_227_248_Open_Image.style.display='inline'; Codehighlighter1_227_248_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;n;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_227_248_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_227_248_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dp[i][i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_281_577_Open_Image onclick="this.style.display='none'; Codehighlighter1_281_577_Open_Text.style.display='none'; Codehighlighter1_281_577_Closed_Image.style.display='inline'; Codehighlighter1_281_577_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_281_577_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_281_577_Closed_Text.style.display='none'; Codehighlighter1_281_577_Open_Image.style.display='inline'; Codehighlighter1_281_577_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;n;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_281_577_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_281_577_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_345_573_Open_Image onclick="this.style.display='none'; Codehighlighter1_345_573_Open_Text.style.display='none'; Codehighlighter1_345_573_Closed_Image.style.display='inline'; Codehighlighter1_345_573_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_345_573_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_345_573_Closed_Text.style.display='none'; Codehighlighter1_345_573_Open_Image.style.display='inline'; Codehighlighter1_345_573_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;t&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;j&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;i;&nbsp;j&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;n&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;t&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;n;&nbsp;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">,&nbsp;t&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;j&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;i)&nbsp;</span><span id=Codehighlighter1_345_573_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_345_573_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;min&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Integer.MAX_VALUE;<br><img id=Codehighlighter1_412_548_Open_Image onclick="this.style.display='none'; Codehighlighter1_412_548_Open_Text.style.display='none'; Codehighlighter1_412_548_Closed_Image.style.display='inline'; Codehighlighter1_412_548_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_412_548_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_412_548_Closed_Text.style.display='none'; Codehighlighter1_412_548_Open_Image.style.display='inline'; Codehighlighter1_412_548_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;k&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;j;&nbsp;k&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;t;&nbsp;k</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_412_548_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_412_548_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&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">int</span><span style="COLOR: #000000">&nbsp;tmp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;dp[j][k]&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;dp[k&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">][t];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&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;(s.charAt(j)&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;s.charAt(t))<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp&nbsp;</span><span style="COLOR: #000000">-=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&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;(min&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;tmp)<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;min&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;tmp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dp[j][t]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;min;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;dp[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">][s.length()&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
<img src ="http://www.cppblog.com/vvilp/aggbug/86658.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/vvilp/" target="_blank">wZt</a> 2009-06-03 15:48 <a href="http://www.cppblog.com/vvilp/articles/86658.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>