﻿<?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++博客-Darren-随笔分类-动态规划</title><link>http://www.cppblog.com/Darren/category/12420.html</link><description>C++ 及算法</description><language>zh-cn</language><lastBuildDate>Fri, 27 Nov 2009 13:59:47 GMT</lastBuildDate><pubDate>Fri, 27 Nov 2009 13:59:47 GMT</pubDate><ttl>60</ttl><item><title>pku  1691  Painting A Board  状态压缩DP</title><link>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 08 Oct 2009 06:54:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/98083.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/10/08/98083.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/98083.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/98083.html</trackback:ping><description><![CDATA[
		<p> </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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">string</span>
				<span style="COLOR: #000000">.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000"> inf</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">&lt;&lt;</span>
				<span style="COLOR: #000000">29</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> n;<br /><img id="Codehighlighter1_101_127_Open_Image" onclick="this.style.display='none'; Codehighlighter1_101_127_Open_Text.style.display='none'; Codehighlighter1_101_127_Closed_Image.style.display='inline'; Codehighlighter1_101_127_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_101_127_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_127_Closed_Text.style.display='none'; Codehighlighter1_101_127_Open_Image.style.display='inline'; Codehighlighter1_101_127_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Point</span>
				<span id="Codehighlighter1_101_127_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_101_127_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> Lx, Ly, Rx, Ry;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />Point pnt[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  need[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">], dp[</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">&lt;&lt;</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">], color[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_199_481_Open_Image" onclick="this.style.display='none'; Codehighlighter1_199_481_Open_Text.style.display='none'; Codehighlighter1_199_481_Closed_Image.style.display='inline'; Codehighlighter1_199_481_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_199_481_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_199_481_Closed_Text.style.display='none'; Codehighlighter1_199_481_Open_Image.style.display='inline'; Codehighlighter1_199_481_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> init()</span>
				<span id="Codehighlighter1_199_481_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_199_481_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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 ) need[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_280_479_Open_Image" onclick="this.style.display='none'; Codehighlighter1_280_479_Open_Text.style.display='none'; Codehighlighter1_280_479_Closed_Image.style.display='inline'; Codehighlighter1_280_479_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_280_479_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_280_479_Closed_Text.style.display='none'; Codehighlighter1_280_479_Open_Image.style.display='inline'; Codehighlighter1_280_479_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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 )</span>
						<span id="Codehighlighter1_280_479_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_280_479_Open_Text">
								<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_315_473_Open_Image" onclick="this.style.display='none'; Codehighlighter1_315_473_Open_Text.style.display='none'; Codehighlighter1_315_473_Closed_Image.style.display='inline'; Codehighlighter1_315_473_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_315_473_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_315_473_Closed_Text.style.display='none'; Codehighlighter1_315_473_Open_Image.style.display='inline'; Codehighlighter1_315_473_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">(</span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> j</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; j</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )</span>
								<span id="Codehighlighter1_315_473_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_315_473_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( i</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> j ) </span>
										<span style="COLOR: #0000ff">continue</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_415_463_Open_Image" onclick="this.style.display='none'; Codehighlighter1_415_463_Open_Text.style.display='none'; Codehighlighter1_415_463_Closed_Image.style.display='inline'; Codehighlighter1_415_463_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_415_463_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_415_463_Closed_Text.style.display='none'; Codehighlighter1_415_463_Open_Image.style.display='inline'; Codehighlighter1_415_463_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( pnt[j].Ry</span>
										<span style="COLOR: #000000">&lt;=</span>
										<span style="COLOR: #000000"> pnt[i].Ly </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> pnt[j].Lx</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> pnt[i].Rx )</span>
										<span id="Codehighlighter1_415_463_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_415_463_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                need[i]</span>
												<span style="COLOR: #000000">|=</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_496_1266_Open_Image" onclick="this.style.display='none'; Codehighlighter1_496_1266_Open_Text.style.display='none'; Codehighlighter1_496_1266_Closed_Image.style.display='inline'; Codehighlighter1_496_1266_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_496_1266_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_496_1266_Closed_Text.style.display='none'; Codehighlighter1_496_1266_Open_Image.style.display='inline'; Codehighlighter1_496_1266_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> solve()</span>
				<span id="Codehighlighter1_496_1266_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_496_1266_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> (</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n); </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">j ) dp[i][j]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> inf;<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" />    dp[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">][</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">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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 /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( need[i]</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> ) dp[</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">i][i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_714_1129_Open_Image" onclick="this.style.display='none'; Codehighlighter1_714_1129_Open_Text.style.display='none'; Codehighlighter1_714_1129_Closed_Image.style.display='inline'; Codehighlighter1_714_1129_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_714_1129_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_714_1129_Closed_Text.style.display='none'; Codehighlighter1_714_1129_Open_Image.style.display='inline'; Codehighlighter1_714_1129_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> s</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; s</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> (</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n); </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">s )</span>
						<span id="Codehighlighter1_714_1129_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_714_1129_Open_Text">
								<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_750_1123_Open_Image" onclick="this.style.display='none'; Codehighlighter1_750_1123_Open_Text.style.display='none'; Codehighlighter1_750_1123_Closed_Image.style.display='inline'; Codehighlighter1_750_1123_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_750_1123_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_750_1123_Closed_Text.style.display='none'; Codehighlighter1_750_1123_Open_Image.style.display='inline'; Codehighlighter1_750_1123_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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 )</span>
								<span id="Codehighlighter1_750_1123_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_750_1123_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( ( s</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000"> (</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">&lt;&lt;</span>
										<span style="COLOR: #000000">i) )</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> ) </span>
										<span style="COLOR: #0000ff">continue</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_837_1113_Open_Image" onclick="this.style.display='none'; Codehighlighter1_837_1113_Open_Text.style.display='none'; Codehighlighter1_837_1113_Closed_Image.style.display='inline'; Codehighlighter1_837_1113_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_837_1113_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_837_1113_Closed_Text.style.display='none'; Codehighlighter1_837_1113_Open_Image.style.display='inline'; Codehighlighter1_837_1113_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> j</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; j</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> n; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">j )</span>
										<span id="Codehighlighter1_837_1113_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_837_1113_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( s</span>
												<span style="COLOR: #000000">&amp;</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j) ) </span>
												<span style="COLOR: #0000ff">continue</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( (s</span>
												<span style="COLOR: #000000">&amp;</span>
												<span style="COLOR: #000000"> need[j])</span>
												<span style="COLOR: #000000">!=</span>
												<span style="COLOR: #000000"> need[j] ) </span>
												<span style="COLOR: #0000ff">continue</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1009_1099_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1009_1099_Open_Text.style.display='none'; Codehighlighter1_1009_1099_Closed_Image.style.display='inline'; Codehighlighter1_1009_1099_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1009_1099_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1009_1099_Closed_Text.style.display='none'; Codehighlighter1_1009_1099_Open_Image.style.display='inline'; Codehighlighter1_1009_1099_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( dp[s][i]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> ( color[i]</span>
												<span style="COLOR: #000000">!=</span>
												<span style="COLOR: #000000"> color[j] )</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> dp[s</span>
												<span style="COLOR: #000000">|</span>
												<span style="COLOR: #000000">(</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">&lt;&lt;</span>
												<span style="COLOR: #000000">j)][j] )</span>
												<span id="Codehighlighter1_1009_1099_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_1009_1099_Open_Text">
														<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    dp[s</span>
														<span style="COLOR: #000000">|</span>
														<span style="COLOR: #000000">(</span>
														<span style="COLOR: #000000">1</span>
														<span style="COLOR: #000000">&lt;&lt;</span>
														<span style="COLOR: #000000">j)][j]</span>
														<span style="COLOR: #000000">=</span>
														<span style="COLOR: #000000"> dp[s][i]</span>
														<span style="COLOR: #000000">+</span>
														<span style="COLOR: #000000"> ( color[i]</span>
														<span style="COLOR: #000000">!=</span>
														<span style="COLOR: #000000"> color[j] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
												</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> ans</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> inf;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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 /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( dp[(</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">][i]</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> ans ) ans</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> dp[(</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">][i];<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" />    printf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d\n</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, ans );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img id="Codehighlighter1_1279_1589_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1279_1589_Open_Text.style.display='none'; Codehighlighter1_1279_1589_Closed_Image.style.display='inline'; Codehighlighter1_1279_1589_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_1279_1589_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1279_1589_Closed_Text.style.display='none'; Codehighlighter1_1279_1589_Open_Image.style.display='inline'; Codehighlighter1_1279_1589_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()</span>
				<span id="Codehighlighter1_1279_1589_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_1279_1589_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> test;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    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">test );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1339_1568_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1339_1568_Open_Text.style.display='none'; Codehighlighter1_1339_1568_Closed_Image.style.display='inline'; Codehighlighter1_1339_1568_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1339_1568_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1339_1568_Closed_Text.style.display='none'; Codehighlighter1_1339_1568_Open_Image.style.display='inline'; Codehighlighter1_1339_1568_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( test</span>
						<span style="COLOR: #000000">--</span>
						<span style="COLOR: #000000"> )</span>
						<span id="Codehighlighter1_1339_1568_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_1339_1568_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        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 );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1401_1528_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1401_1528_Open_Text.style.display='none'; Codehighlighter1_1401_1528_Closed_Image.style.display='inline'; Codehighlighter1_1401_1528_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1401_1528_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1401_1528_Closed_Text.style.display='none'; Codehighlighter1_1401_1528_Open_Image.style.display='inline'; Codehighlighter1_1401_1528_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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 )</span>
								<span id="Codehighlighter1_1401_1528_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_1401_1528_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d%d%d%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Ly, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Lx, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Ry,  </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">pnt[i].Rx );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, color</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> i );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        init();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        solve();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
		<br />
<img src ="http://www.cppblog.com/Darren/aggbug/98083.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-10-08 14:54 <a href="http://www.cppblog.com/Darren/archive/2009/10/08/98083.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1276  Cash Machine</title><link>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Sun, 19 Jul 2009 05:44:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90518.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/19/90518.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90518.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90518.html</trackback:ping><description><![CDATA[
		<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">
				<span style="COLOR: #000000">#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 />
						<br />
				</span>
				<span style="COLOR: #0000ff">using</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">namespace</span>
				<span style="COLOR: #000000"> std;<br /><br /></span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 100001</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> nk[</span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">], dk[</span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">], n, m, ans[N], num[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">m,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">n )</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000"> EOF ){<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</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 ) scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, nk</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> i, dk</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> i );<br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</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"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) ans[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; ans[</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 />        <br />        </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i</span>
				<span style="COLOR: #000000">=</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: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">; j</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j ) num[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />            <br />            </span>
				<span style="COLOR: #0000ff">for</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dk[i]; j</span>
				<span style="COLOR: #000000">&lt;=</span>
				<span style="COLOR: #000000"> m; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j )<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> ans[j] </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> ans[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">dk[i]] </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> num[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> dk[i]]</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> nk[i] ){<br />                num[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> num[j</span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">dk[i]]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">;<br />                ans[j]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">; }<br />        }<br />        <br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> res</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> m;<br />        </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( ans[res]</span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">&amp;&amp;</span>
				<span style="COLOR: #000000"> res</span>
				<span style="COLOR: #000000">&gt;=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000"> ) res</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000">;<br />        printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, res );<br />    }<br />    <br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />}<br /></span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/90518.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2009-07-19 13:44 <a href="http://www.cppblog.com/Darren/archive/2009/07/19/90518.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1651   Multiplication Puzzle</title><link>http://www.cppblog.com/Darren/archive/2008/11/03/65861.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 03 Nov 2008 09:56:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/11/03/65861.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65861.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/11/03/65861.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65861.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65861.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">     n;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">     r[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">     p[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">]; <br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_82_556_Open_Image" onclick="this.style.display='none'; Codehighlighter1_82_556_Open_Text.style.display='none'; Codehighlighter1_82_556_Closed_Image.style.display='inline'; Codehighlighter1_82_556_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_82_556_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_82_556_Closed_Text.style.display='none'; Codehighlighter1_82_556_Open_Image.style.display='inline'; Codehighlighter1_82_556_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_82_556_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_82_556_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</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">&amp;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> EOF )<br /><img id="Codehighlighter1_116_541_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_541_Open_Text.style.display='none'; Codehighlighter1_116_541_Closed_Image.style.display='inline'; Codehighlighter1_116_541_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_116_541_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_116_541_Closed_Text.style.display='none'; Codehighlighter1_116_541_Open_Image.style.display='inline'; Codehighlighter1_116_541_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_116_541_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_116_541_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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 /><img id="Codehighlighter1_149_220_Open_Image" onclick="this.style.display='none'; Codehighlighter1_149_220_Open_Text.style.display='none'; Codehighlighter1_149_220_Closed_Image.style.display='inline'; Codehighlighter1_149_220_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_149_220_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_149_220_Closed_Text.style.display='none'; Codehighlighter1_149_220_Open_Image.style.display='inline'; Codehighlighter1_149_220_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_149_220_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_149_220_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            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">p[i] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            r[i][i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; r[i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">][i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; r[i][i</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">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> d</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">; d</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">d )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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"> d; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img id="Codehighlighter1_296_505_Open_Image" onclick="this.style.display='none'; Codehighlighter1_296_505_Open_Text.style.display='none'; Codehighlighter1_296_505_Closed_Image.style.display='inline'; Codehighlighter1_296_505_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_296_505_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_296_505_Closed_Text.style.display='none'; Codehighlighter1_296_505_Open_Image.style.display='inline'; Codehighlighter1_296_505_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_296_505_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_296_505_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> j</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> d;<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" />                r[i][j]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> r[i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">][j]</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> p[i]</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000"> p[i</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"> p[j];<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" />                </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> k</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">; k</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> j; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">k )<br /><img id="Codehighlighter1_406_500_Open_Image" onclick="this.style.display='none'; Codehighlighter1_406_500_Open_Text.style.display='none'; Codehighlighter1_406_500_Closed_Image.style.display='inline'; Codehighlighter1_406_500_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_406_500_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_406_500_Closed_Text.style.display='none'; Codehighlighter1_406_500_Open_Image.style.display='inline'; Codehighlighter1_406_500_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
										<span id="Codehighlighter1_406_500_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_406_500_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> t</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> r[i][k]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> r[k][j]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> p[i]</span>
												<span style="COLOR: #000000">*</span>
												<span style="COLOR: #000000"> p[k]</span>
												<span style="COLOR: #000000">*</span>
												<span style="COLOR: #000000"> p[j];<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" />                    </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( t</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> r[i][j] ) r[i][j]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> t;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</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" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, r[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">][n</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/65861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-11-03 17:56 <a href="http://www.cppblog.com/Darren/archive/2008/11/03/65861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>矩阵连乘</title><link>http://www.cppblog.com/Darren/archive/2008/11/03/65852.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 03 Nov 2008 09:05:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/11/03/65852.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65852.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/11/03/65852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65852.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65852.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000">  Matrix<br /><img id="Codehighlighter1_35_47_Open_Image" onclick="this.style.display='none'; Codehighlighter1_35_47_Open_Text.style.display='none'; Codehighlighter1_35_47_Closed_Image.style.display='inline'; Codehighlighter1_35_47_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_35_47_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_35_47_Closed_Text.style.display='none'; Codehighlighter1_35_47_Open_Image.style.display='inline'; Codehighlighter1_35_47_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_35_47_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_35_47_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> r,c;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">     n;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">     r[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />Matrix  p[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">];   </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">   The Matrix with row and column</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img id="Codehighlighter1_138_180_Open_Image" onclick="this.style.display='none'; Codehighlighter1_138_180_Open_Text.style.display='none'; Codehighlighter1_138_180_Closed_Image.style.display='inline'; Codehighlighter1_138_180_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_138_180_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_138_180_Closed_Text.style.display='none'; Codehighlighter1_138_180_Open_Image.style.display='inline'; Codehighlighter1_138_180_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span id="Codehighlighter1_138_180_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">/**/</span>
				<span id="Codehighlighter1_138_180_Open_Text">
						<span style="COLOR: #008000">/*</span>
						<span style="COLOR: #008000">
								<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" />6<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />30 35 35 15 15 5 5 10 10 20 20 25<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span>
						<span style="COLOR: #008000">*/</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_194_665_Open_Image" onclick="this.style.display='none'; Codehighlighter1_194_665_Open_Text.style.display='none'; Codehighlighter1_194_665_Closed_Image.style.display='inline'; Codehighlighter1_194_665_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_194_665_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_194_665_Closed_Text.style.display='none'; Codehighlighter1_194_665_Open_Image.style.display='inline'; Codehighlighter1_194_665_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_194_665_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_194_665_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</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">&amp;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> EOF )<br /><img id="Codehighlighter1_228_650_Open_Image" onclick="this.style.display='none'; Codehighlighter1_228_650_Open_Text.style.display='none'; Codehighlighter1_228_650_Closed_Image.style.display='inline'; Codehighlighter1_228_650_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_228_650_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_228_650_Closed_Text.style.display='none'; Codehighlighter1_228_650_Open_Image.style.display='inline'; Codehighlighter1_228_650_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_228_650_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_228_650_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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 /><img id="Codehighlighter1_261_317_Open_Image" onclick="this.style.display='none'; Codehighlighter1_261_317_Open_Text.style.display='none'; Codehighlighter1_261_317_Closed_Image.style.display='inline'; Codehighlighter1_261_317_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_261_317_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_261_317_Closed_Text.style.display='none'; Codehighlighter1_261_317_Open_Image.style.display='inline'; Codehighlighter1_261_317_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_261_317_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_261_317_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            scanf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">p[i].r, </span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">p[i].c );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            r[i][i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> d</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; d</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> n; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">d )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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"> d; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img id="Codehighlighter1_393_614_Open_Image" onclick="this.style.display='none'; Codehighlighter1_393_614_Open_Text.style.display='none'; Codehighlighter1_393_614_Closed_Image.style.display='inline'; Codehighlighter1_393_614_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_393_614_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_393_614_Closed_Text.style.display='none'; Codehighlighter1_393_614_Open_Image.style.display='inline'; Codehighlighter1_393_614_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_393_614_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_393_614_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> j</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> d;<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" />                r[i][j]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> r[i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">][j]</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> p[i].r</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000"> p[i].c</span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000"> p[j].c;<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" />                </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> k</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">; k</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> j; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">k )<br /><img id="Codehighlighter1_507_609_Open_Image" onclick="this.style.display='none'; Codehighlighter1_507_609_Open_Text.style.display='none'; Codehighlighter1_507_609_Closed_Image.style.display='inline'; Codehighlighter1_507_609_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_507_609_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_507_609_Closed_Text.style.display='none'; Codehighlighter1_507_609_Open_Image.style.display='inline'; Codehighlighter1_507_609_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
										<span id="Codehighlighter1_507_609_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_507_609_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> t</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> r[i][k]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> r[k</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">][j]</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> p[i].r</span>
												<span style="COLOR: #000000">*</span>
												<span style="COLOR: #000000"> p[k].c</span>
												<span style="COLOR: #000000">*</span>
												<span style="COLOR: #000000"> p[j].c;<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" />                    </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( t</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> r[i][j] ) r[i][j]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> t;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</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" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, r[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">][n</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/65852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-11-03 17:05 <a href="http://www.cppblog.com/Darren/archive/2008/11/03/65852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1023   The Fun Number System</title><link>http://www.cppblog.com/Darren/archive/2008/10/30/65548.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 30 Oct 2008 03:57:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/30/65548.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65548.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/30/65548.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65548.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65548.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_31_557_Open_Image" onclick="this.style.display='none'; Codehighlighter1_31_557_Open_Text.style.display='none'; Codehighlighter1_31_557_Closed_Image.style.display='inline'; Codehighlighter1_31_557_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_31_557_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_31_557_Closed_Text.style.display='none'; Codehighlighter1_31_557_Open_Image.style.display='inline'; Codehighlighter1_31_557_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_31_557_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_31_557_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> test;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    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">test);<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" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( test</span>
						<span style="COLOR: #000000">--</span>
						<span style="COLOR: #000000"> )<br /><img id="Codehighlighter1_85_542_Open_Image" onclick="this.style.display='none'; Codehighlighter1_85_542_Open_Text.style.display='none'; Codehighlighter1_85_542_Closed_Image.style.display='inline'; Codehighlighter1_85_542_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_85_542_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_85_542_Closed_Text.style.display='none'; Codehighlighter1_85_542_Open_Image.style.display='inline'; Codehighlighter1_85_542_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_85_542_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_85_542_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        __int64   len, data;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">char</span>
								<span style="COLOR: #000000">      str[</span>
								<span style="COLOR: #000000">100</span>
								<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000">       result[</span>
								<span style="COLOR: #000000">200</span>
								<span style="COLOR: #000000">], t</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</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" />        scanf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%I64d%s%I64d</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">len,str,</span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">data );<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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> len</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&gt;=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">--</span>
								<span style="COLOR: #000000"> )<br /><img id="Codehighlighter1_248_391_Open_Image" onclick="this.style.display='none'; Codehighlighter1_248_391_Open_Text.style.display='none'; Codehighlighter1_248_391_Closed_Image.style.display='inline'; Codehighlighter1_248_391_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_248_391_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_248_391_Closed_Text.style.display='none'; Codehighlighter1_248_391_Open_Image.style.display='inline'; Codehighlighter1_248_391_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_248_391_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_248_391_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> a</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> ( data</span>
										<span style="COLOR: #000000">%</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">)</span>
										<span style="COLOR: #000000">%</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[t</span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> a;<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" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( str[i]</span>
										<span style="COLOR: #000000">==</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"> )  data</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> ( data</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> a )</span>
										<span style="COLOR: #000000">/</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">else</span>
										<span style="COLOR: #000000">                data</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> ( data</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000"> a )</span>
										<span style="COLOR: #000000">/</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">2</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( data</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_415_506_Open_Image" onclick="this.style.display='none'; Codehighlighter1_415_506_Open_Text.style.display='none'; Codehighlighter1_415_506_Closed_Image.style.display='inline'; Codehighlighter1_415_506_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_415_506_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_415_506_Closed_Text.style.display='none'; Codehighlighter1_415_506_Open_Image.style.display='inline'; Codehighlighter1_415_506_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_415_506_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_415_506_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> t</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">; i</span>
										<span style="COLOR: #000000">&gt;=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; i</span>
										<span style="COLOR: #000000">--</span>
										<span style="COLOR: #000000"> ) <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            printf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, result[i] ); <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" />            printf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">  printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Impossible\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/65548.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-30 11:57 <a href="http://www.cppblog.com/Darren/archive/2008/10/30/65548.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku   1032  Parliament</title><link>http://www.cppblog.com/Darren/archive/2008/10/29/65436.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 29 Oct 2008 02:26:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/29/65436.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65436.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/29/65436.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65436.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65436.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> result[</span>
				<span style="COLOR: #000000">500</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_49_590_Open_Image" onclick="this.style.display='none'; Codehighlighter1_49_590_Open_Text.style.display='none'; Codehighlighter1_49_590_Closed_Image.style.display='inline'; Codehighlighter1_49_590_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_49_590_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_49_590_Closed_Text.style.display='none'; Codehighlighter1_49_590_Open_Image.style.display='inline'; Codehighlighter1_49_590_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_49_590_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_49_590_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> n;<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" />    </span>
						<span style="COLOR: #0000ff">while</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">&amp;</span>
						<span style="COLOR: #000000">n)</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> EOF )<br /><img id="Codehighlighter1_93_575_Open_Image" onclick="this.style.display='none'; Codehighlighter1_93_575_Open_Text.style.display='none'; Codehighlighter1_93_575_Closed_Image.style.display='inline'; Codehighlighter1_93_575_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_93_575_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_93_575_Closed_Text.style.display='none'; Codehighlighter1_93_575_Open_Image.style.display='inline'; Codehighlighter1_93_575_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_93_575_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_93_575_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> sum</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> len</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> value</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img id="Codehighlighter1_157_234_Open_Image" onclick="this.style.display='none'; Codehighlighter1_157_234_Open_Text.style.display='none'; Codehighlighter1_157_234_Closed_Image.style.display='inline'; Codehighlighter1_157_234_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_157_234_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_157_234_Closed_Text.style.display='none'; Codehighlighter1_157_234_Open_Image.style.display='inline'; Codehighlighter1_157_234_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">while</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">true</span>
								<span style="COLOR: #000000"> )</span>
								<span id="Codehighlighter1_157_234_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_157_234_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            sum</span>
										<span style="COLOR: #000000">+=</span>
										<span style="COLOR: #000000"> value;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[len</span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> value</span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( sum</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> value</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000"> n ) </span>
										<span style="COLOR: #0000ff">break</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        value</span>
								<span style="COLOR: #000000">--</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> left</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> n</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> sum;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( value</span>
								<span style="COLOR: #000000">==</span>
								<span style="COLOR: #000000"> left )<br /><img id="Codehighlighter1_290_359_Open_Image" onclick="this.style.display='none'; Codehighlighter1_290_359_Open_Text.style.display='none'; Codehighlighter1_290_359_Closed_Image.style.display='inline'; Codehighlighter1_290_359_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_290_359_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_290_359_Closed_Text.style.display='none'; Codehighlighter1_290_359_Open_Image.style.display='inline'; Codehighlighter1_290_359_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_290_359_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_290_359_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">=</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"> len; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">i ) result[i]</span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[len</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">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> len</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&gt;=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">, left</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">--</span>
								<span style="COLOR: #000000">, left</span>
								<span style="COLOR: #000000">--</span>
								<span style="COLOR: #000000"> ) result[i]</span>
								<span style="COLOR: #000000">++</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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"> len; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i ) <br /><img id="Codehighlighter1_468_555_Open_Image" onclick="this.style.display='none'; Codehighlighter1_468_555_Open_Text.style.display='none'; Codehighlighter1_468_555_Closed_Image.style.display='inline'; Codehighlighter1_468_555_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_468_555_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_468_555_Closed_Text.style.display='none'; Codehighlighter1_468_555_Open_Image.style.display='inline'; Codehighlighter1_468_555_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_468_555_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_468_555_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( i</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> ) printf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">%d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, result[i] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">else</span>
										<span style="COLOR: #000000">        printf(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> %d</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, result[i] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<br />做法就是求出以2起始的最大连续自然数序列之和sum，使得sum的值不超过输入数n，<br />然后分情况讨论：<br /><br />设此最大序列为2、3、……、w，则：<br /><br />1。若剩余值（n-sum）等于w，则最后输出序列为：3、4、……、w、w+2，即将原最大序列每项加1，再将最后剩余的一个1加到最后一项上。<br /><br />2。若剩余值（n-sum）小于w，则从序列的最大项i开始，从大到小依次将每项加1，直到剩余值用完。<br /><br /><img src ="http://www.cppblog.com/Darren/aggbug/65436.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-29 10:26 <a href="http://www.cppblog.com/Darren/archive/2008/10/29/65436.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1046   Color Me Less</title><link>http://www.cppblog.com/Darren/archive/2008/10/28/65405.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Tue, 28 Oct 2008 14:08:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/28/65405.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65405.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/28/65405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65405.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65405.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">math.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Point<br /><img id="Codehighlighter1_51_70_Open_Image" onclick="this.style.display='none'; Codehighlighter1_51_70_Open_Text.style.display='none'; Codehighlighter1_51_70_Closed_Image.style.display='inline'; Codehighlighter1_51_70_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_51_70_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_51_70_Closed_Text.style.display='none'; Codehighlighter1_51_70_Open_Image.style.display='inline'; Codehighlighter1_51_70_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_51_70_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_51_70_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">double</span>
						<span style="COLOR: #000000"> x, y, z;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />Point  d[</span>
				<span style="COLOR: #000000">16</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">double</span>
				<span style="COLOR: #000000"> dis( Point </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> a, Point </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> b )<br /><img id="Codehighlighter1_134_229_Open_Image" onclick="this.style.display='none'; Codehighlighter1_134_229_Open_Text.style.display='none'; Codehighlighter1_134_229_Closed_Image.style.display='inline'; Codehighlighter1_134_229_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_134_229_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_134_229_Closed_Text.style.display='none'; Codehighlighter1_134_229_Open_Image.style.display='inline'; Codehighlighter1_134_229_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_134_229_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_134_229_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> sqrt( ( a.x</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.x )</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000"> (a.x</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.x )</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> ( a.y</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.y )</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000"> (a.y</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.y )</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> (a.z</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.z)</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">(a.z</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> b.z) );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_245_761_Open_Image" onclick="this.style.display='none'; Codehighlighter1_245_761_Open_Text.style.display='none'; Codehighlighter1_245_761_Closed_Image.style.display='inline'; Codehighlighter1_245_761_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_245_761_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_245_761_Closed_Text.style.display='none'; Codehighlighter1_245_761_Open_Image.style.display='inline'; Codehighlighter1_245_761_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_245_761_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_245_761_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> </span>
						<span style="COLOR: #000000">16</span>
						<span style="COLOR: #000000">; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )  scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%lf%lf%lf</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">d[i].x, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">d[i].y, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">d[i].z );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    Point temp;<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" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%lf%lf%lf</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">temp.x, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">temp.y, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">temp.z), temp.x</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"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> temp.y</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"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> temp.z</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 id="Codehighlighter1_440_746_Open_Image" onclick="this.style.display='none'; Codehighlighter1_440_746_Open_Text.style.display='none'; Codehighlighter1_440_746_Closed_Image.style.display='inline'; Codehighlighter1_440_746_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_440_746_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_440_746_Closed_Text.style.display='none'; Codehighlighter1_440_746_Open_Image.style.display='inline'; Codehighlighter1_440_746_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_440_746_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_440_746_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">double</span>
								<span style="COLOR: #000000"> min</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">250</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">50</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </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">-</span>
								<span style="COLOR: #000000">1</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</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"> </span>
								<span style="COLOR: #000000">16</span>
								<span style="COLOR: #000000">; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img id="Codehighlighter1_541_625_Open_Image" onclick="this.style.display='none'; Codehighlighter1_541_625_Open_Text.style.display='none'; Codehighlighter1_541_625_Closed_Image.style.display='inline'; Codehighlighter1_541_625_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_541_625_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_541_625_Closed_Text.style.display='none'; Codehighlighter1_541_625_Open_Image.style.display='inline'; Codehighlighter1_541_625_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_541_625_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_541_625_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( dis( d[i], temp )</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> min )<br /><img id="Codehighlighter1_578_621_Open_Image" onclick="this.style.display='none'; Codehighlighter1_578_621_Open_Text.style.display='none'; Codehighlighter1_578_621_Closed_Image.style.display='inline'; Codehighlighter1_578_621_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_578_621_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_578_621_Closed_Text.style.display='none'; Codehighlighter1_578_621_Open_Image.style.display='inline'; Codehighlighter1_578_621_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_578_621_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_578_621_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                min</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> dis( d[i], temp );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                k</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> i;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        printf( </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">(%.0lf,%.0lf,%.0lf) maps to (%.0lf,%.0lf,%.0lf)\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">,  temp.x, temp.y, temp.z, d[k].x, d[k].y, d[k].z );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/65405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-28 22:08 <a href="http://www.cppblog.com/Darren/archive/2008/10/28/65405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1080    Human Gene Functions</title><link>http://www.cppblog.com/Darren/archive/2008/10/28/65354.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Tue, 28 Oct 2008 10:34:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/28/65354.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65354.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/28/65354.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65354.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65354.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> m, n;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000"> a[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">], b[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  result[</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">110</span>
				<span style="COLOR: #000000">];<br /><img id="Codehighlighter1_92_301_Open_Image" onclick="this.style.display='none'; Codehighlighter1_92_301_Open_Text.style.display='none'; Codehighlighter1_92_301_Closed_Image.style.display='inline'; Codehighlighter1_92_301_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_92_301_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_92_301_Closed_Text.style.display='none'; Codehighlighter1_92_301_Open_Image.style.display='inline'; Codehighlighter1_92_301_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  value[</span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_92_301_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_92_301_Open_Text">
						<span style="COLOR: #000000">{   </span>
						<span id="Codehighlighter1_96_116_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_96_116_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #000000">5</span>
								<span style="COLOR: #000000">, </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">2</span>
								<span style="COLOR: #000000">, </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">3</span>
								<span style="COLOR: #000000"> }</span>
						</span>
						<span style="COLOR: #000000">,<br /><img id="Codehighlighter1_141_161_Open_Image" onclick="this.style.display='none'; Codehighlighter1_141_161_Open_Text.style.display='none'; Codehighlighter1_141_161_Closed_Image.style.display='inline'; Codehighlighter1_141_161_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_141_161_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_141_161_Closed_Text.style.display='none'; Codehighlighter1_141_161_Open_Image.style.display='inline'; Codehighlighter1_141_161_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                      </span>
						<span id="Codehighlighter1_141_161_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_141_161_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">5</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">3</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000"> }</span>
						</span>
						<span style="COLOR: #000000">,<br /><img id="Codehighlighter1_186_206_Open_Image" onclick="this.style.display='none'; Codehighlighter1_186_206_Open_Text.style.display='none'; Codehighlighter1_186_206_Closed_Image.style.display='inline'; Codehighlighter1_186_206_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_186_206_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_186_206_Closed_Text.style.display='none'; Codehighlighter1_186_206_Open_Image.style.display='inline'; Codehighlighter1_186_206_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                      </span>
						<span id="Codehighlighter1_186_206_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_186_206_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">3</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">5</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000"> }</span>
						</span>
						<span style="COLOR: #000000">,<br /><img id="Codehighlighter1_231_251_Open_Image" onclick="this.style.display='none'; Codehighlighter1_231_251_Open_Text.style.display='none'; Codehighlighter1_231_251_Closed_Image.style.display='inline'; Codehighlighter1_231_251_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_231_251_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_231_251_Closed_Text.style.display='none'; Codehighlighter1_231_251_Open_Image.style.display='inline'; Codehighlighter1_231_251_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                      </span>
						<span id="Codehighlighter1_231_251_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_231_251_Open_Text">
								<span style="COLOR: #000000">{ </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">2</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">5</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000"> }</span>
						</span>
						<span style="COLOR: #000000">,<br /><img id="Codehighlighter1_276_299_Open_Image" onclick="this.style.display='none'; Codehighlighter1_276_299_Open_Text.style.display='none'; Codehighlighter1_276_299_Closed_Image.style.display='inline'; Codehighlighter1_276_299_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_276_299_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_276_299_Closed_Text.style.display='none'; Codehighlighter1_276_299_Open_Image.style.display='inline'; Codehighlighter1_276_299_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                      </span>
						<span id="Codehighlighter1_276_299_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_276_299_Open_Text">
								<span style="COLOR: #000000">{ </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">3</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">, </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">1000</span>
								<span style="COLOR: #000000">}</span>
						</span>
						<span style="COLOR: #000000"> }</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> getid( </span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000"> ch )<br /><img id="Codehighlighter1_326_477_Open_Image" onclick="this.style.display='none'; Codehighlighter1_326_477_Open_Text.style.display='none'; Codehighlighter1_326_477_Closed_Image.style.display='inline'; Codehighlighter1_326_477_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_326_477_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_326_477_Closed_Text.style.display='none'; Codehighlighter1_326_477_Open_Image.style.display='inline'; Codehighlighter1_326_477_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_326_477_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_326_477_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">switch</span>
						<span style="COLOR: #000000">( ch )<br /><img id="Codehighlighter1_343_461_Open_Image" onclick="this.style.display='none'; Codehighlighter1_343_461_Open_Text.style.display='none'; Codehighlighter1_343_461_Closed_Image.style.display='inline'; Codehighlighter1_343_461_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_343_461_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_343_461_Closed_Text.style.display='none'; Codehighlighter1_343_461_Open_Image.style.display='inline'; Codehighlighter1_343_461_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_343_461_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_343_461_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">case</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">A</span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">:  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">case</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">C</span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">:  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">case</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">G</span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">:  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">case</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">T</span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">:  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">3</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">case</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">'</span>
								<span style="COLOR: #000000">:  </span>
								<span style="COLOR: #0000ff">return</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> solve()<br /><img id="Codehighlighter1_492_1133_Open_Image" onclick="this.style.display='none'; Codehighlighter1_492_1133_Open_Text.style.display='none'; Codehighlighter1_492_1133_Closed_Image.style.display='inline'; Codehighlighter1_492_1133_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_492_1133_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_492_1133_Closed_Text.style.display='none'; Codehighlighter1_492_1133_Open_Image.style.display='inline'; Codehighlighter1_492_1133_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_492_1133_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_492_1133_Open_Text">
						<span style="COLOR: #000000">{    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    result[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">][</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">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> m; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i ) result[i</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">][</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> result[i][</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">]</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> value[ getid( a[i] ) ][</span>
						<span style="COLOR: #000000">4</span>
						<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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 ) result[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">][i</span>
						<span style="COLOR: #000000">+</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"> result[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">][i]</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> value[</span>
						<span style="COLOR: #000000">4</span>
						<span style="COLOR: #000000">][ getid( b[i] ) ];<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" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> m; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">j )<br /><img id="Codehighlighter1_745_1107_Open_Image" onclick="this.style.display='none'; Codehighlighter1_745_1107_Open_Text.style.display='none'; Codehighlighter1_745_1107_Closed_Image.style.display='inline'; Codehighlighter1_745_1107_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_745_1107_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_745_1107_Closed_Text.style.display='none'; Codehighlighter1_745_1107_Open_Image.style.display='inline'; Codehighlighter1_745_1107_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
						<span id="Codehighlighter1_745_1107_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_745_1107_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j</span>
								<span style="COLOR: #000000">+</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"> result[i][j]</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> value[ getid( a[i] ) ][ getid( b[j] ) ];<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" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j]</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> value[</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">][ getid( b[j] ) ] </span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j</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"> result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j]</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> value[</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">][ getid( b[j] ) ];<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" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( result[i][j</span>
								<span style="COLOR: #000000">+</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"> value[ getid( a[i] ) ][</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">] </span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            result[i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][j</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"> result[i][j</span>
								<span style="COLOR: #000000">+</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"> value[ getid( a[i] ) ][</span>
								<span style="COLOR: #000000">4</span>
								<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> result[m][n];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_1147_1319_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1147_1319_Open_Text.style.display='none'; Codehighlighter1_1147_1319_Closed_Image.style.display='inline'; Codehighlighter1_1147_1319_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1147_1319_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1147_1319_Closed_Text.style.display='none'; Codehighlighter1_1147_1319_Open_Image.style.display='inline'; Codehighlighter1_1147_1319_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_1147_1319_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_1147_1319_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> test;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    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">test);<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" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( test</span>
						<span style="COLOR: #000000">--</span>
						<span style="COLOR: #000000"> )<br /><img id="Codehighlighter1_1200_1305_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1200_1305_Open_Text.style.display='none'; Codehighlighter1_1200_1305_Closed_Image.style.display='inline'; Codehighlighter1_1200_1305_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1200_1305_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1200_1305_Closed_Text.style.display='none'; Codehighlighter1_1200_1305_Open_Image.style.display='inline'; Codehighlighter1_1200_1305_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_1200_1305_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_1200_1305_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        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">m); scanf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%s</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, a );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        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); scanf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%s</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, b );<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" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, solve() );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/65354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-28 18:34 <a href="http://www.cppblog.com/Darren/archive/2008/10/28/65354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  3096  Surprising Strings</title><link>http://www.cppblog.com/Darren/archive/2008/10/10/63642.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Fri, 10 Oct 2008 04:18:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/10/63642.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63642.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/10/63642.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63642.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63642.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">map</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">cstdio</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Node<br /><img id="Codehighlighter1_68_127_Open_Image" onclick="this.style.display='none'; Codehighlighter1_68_127_Open_Text.style.display='none'; Codehighlighter1_68_127_Closed_Image.style.display='inline'; Codehighlighter1_68_127_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_68_127_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_68_127_Closed_Text.style.display='none'; Codehighlighter1_68_127_Open_Image.style.display='inline'; Codehighlighter1_68_127_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_68_127_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_68_127_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000">  a, b;<br /><img id="Codehighlighter1_90_91_Open_Image" onclick="this.style.display='none'; Codehighlighter1_90_91_Open_Text.style.display='none'; Codehighlighter1_90_91_Closed_Image.style.display='inline'; Codehighlighter1_90_91_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_90_91_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_90_91_Closed_Text.style.display='none'; Codehighlighter1_90_91_Open_Image.style.display='inline'; Codehighlighter1_90_91_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    Node()</span>
						<span id="Codehighlighter1_90_91_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_90_91_Open_Text">
								<span style="COLOR: #000000">{}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_124_125_Open_Image" onclick="this.style.display='none'; Codehighlighter1_124_125_Open_Text.style.display='none'; Codehighlighter1_124_125_Closed_Image.style.display='inline'; Codehighlighter1_124_125_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_124_125_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_124_125_Closed_Text.style.display='none'; Codehighlighter1_124_125_Open_Image.style.display='inline'; Codehighlighter1_124_125_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    Node( </span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000"> x,</span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000"> y):a(x),b(y)</span>
						<span id="Codehighlighter1_124_125_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_124_125_Open_Text">
								<span style="COLOR: #000000">{}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">operator</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> ( Node x, Node y )<br /><img id="Codehighlighter1_165_220_Open_Image" onclick="this.style.display='none'; Codehighlighter1_165_220_Open_Text.style.display='none'; Codehighlighter1_165_220_Closed_Image.style.display='inline'; Codehighlighter1_165_220_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_165_220_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_165_220_Closed_Text.style.display='none'; Codehighlighter1_165_220_Open_Image.style.display='inline'; Codehighlighter1_165_220_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_165_220_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_165_220_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( x.a</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> y.a )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> x.b</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> y.b;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> x.a</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> y.a;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_234_861_Open_Image" onclick="this.style.display='none'; Codehighlighter1_234_861_Open_Text.style.display='none'; Codehighlighter1_234_861_Closed_Image.style.display='inline'; Codehighlighter1_234_861_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_234_861_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_234_861_Closed_Text.style.display='none'; Codehighlighter1_234_861_Open_Image.style.display='inline'; Codehighlighter1_234_861_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_234_861_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_234_861_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000"> str[</span>
						<span style="COLOR: #000000">80</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" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( gets(str), str[</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">'</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">'</span>
						<span style="COLOR: #000000"> )<br /><img id="Codehighlighter1_288_846_Open_Image" onclick="this.style.display='none'; Codehighlighter1_288_846_Open_Text.style.display='none'; Codehighlighter1_288_846_Closed_Image.style.display='inline'; Codehighlighter1_288_846_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_288_846_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_288_846_Closed_Text.style.display='none'; Codehighlighter1_288_846_Open_Image.style.display='inline'; Codehighlighter1_288_846_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_288_846_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_288_846_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">bool</span>
								<span style="COLOR: #000000"> b</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">true</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000">( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> t</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; t</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> strlen(str); </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">t )<br /><img id="Codehighlighter1_350_738_Open_Image" onclick="this.style.display='none'; Codehighlighter1_350_738_Open_Text.style.display='none'; Codehighlighter1_350_738_Closed_Image.style.display='inline'; Codehighlighter1_350_738_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_350_738_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_350_738_Closed_Text.style.display='none'; Codehighlighter1_350_738_Open_Image.style.display='inline'; Codehighlighter1_350_738_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_350_738_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_350_738_Open_Text">
										<span style="COLOR: #000000">{    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            map</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000">Node,</span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000"> d;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">bool</span>
										<span style="COLOR: #000000"> isok</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">true</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" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> i</span>
										<span style="COLOR: #000000">=</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"> strlen(str); </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">i )<br /><img id="Codehighlighter1_440_676_Open_Image" onclick="this.style.display='none'; Codehighlighter1_440_676_Open_Text.style.display='none'; Codehighlighter1_440_676_Closed_Image.style.display='inline'; Codehighlighter1_440_676_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_440_676_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_440_676_Closed_Text.style.display='none'; Codehighlighter1_440_676_Open_Image.style.display='inline'; Codehighlighter1_440_676_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_440_676_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_440_676_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( (i</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000">t)</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> strlen(str) </span>
												<span style="COLOR: #000000">&amp;&amp;</span>
												<span style="COLOR: #000000"> d[ Node( str[i], str[t</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> i] ) ]</span>
												<span style="COLOR: #000000">==</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000"> )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                     d[ Node( str[i], str[t</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> i] ) ]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">else</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000">( (i</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000">t)</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> strlen(str) </span>
												<span style="COLOR: #000000">&amp;&amp;</span>
												<span style="COLOR: #000000"> d[ Node( str[i],str[t</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> i]) ]</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_627_671_Open_Image" onclick="this.style.display='none'; Codehighlighter1_627_671_Open_Text.style.display='none'; Codehighlighter1_627_671_Closed_Image.style.display='inline'; Codehighlighter1_627_671_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_627_671_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_627_671_Closed_Text.style.display='none'; Codehighlighter1_627_671_Open_Image.style.display='inline'; Codehighlighter1_627_671_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span id="Codehighlighter1_627_671_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_627_671_Open_Text">
														<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                     isok</span>
														<span style="COLOR: #000000">=</span>
														<span style="COLOR: #000000"> </span>
														<span style="COLOR: #0000ff">false</span>
														<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                     </span>
														<span style="COLOR: #0000ff">break</span>
														<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
												</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</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" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">( </span>
										<span style="COLOR: #000000">!</span>
										<span style="COLOR: #000000">isok )<br /><img id="Codehighlighter1_700_733_Open_Image" onclick="this.style.display='none'; Codehighlighter1_700_733_Open_Text.style.display='none'; Codehighlighter1_700_733_Closed_Image.style.display='inline'; Codehighlighter1_700_733_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_700_733_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_700_733_Closed_Text.style.display='none'; Codehighlighter1_700_733_Open_Image.style.display='inline'; Codehighlighter1_700_733_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_700_733_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_700_733_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                b</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">false</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">break</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( b )   printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%s is surprising.\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">,str); <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">      printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%s is NOT surprising.\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">,str); <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-10 12:18 <a href="http://www.cppblog.com/Darren/archive/2008/10/10/63642.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1745   Divisibility</title><link>http://www.cppblog.com/Darren/archive/2008/10/09/63534.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 09 Oct 2008 04:37:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/09/63534.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63534.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/09/63534.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63534.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63534.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">string</span>
				<span style="COLOR: #000000">.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  n, k;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  d[</span>
				<span style="COLOR: #000000">10001</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> result[</span>
				<span style="COLOR: #000000">10001</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">101</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_123_928_Open_Image" onclick="this.style.display='none'; Codehighlighter1_123_928_Open_Text.style.display='none'; Codehighlighter1_123_928_Closed_Image.style.display='inline'; Codehighlighter1_123_928_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_123_928_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_123_928_Closed_Text.style.display='none'; Codehighlighter1_123_928_Open_Image.style.display='inline'; Codehighlighter1_123_928_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_123_928_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_123_928_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d%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">&amp;</span>
						<span style="COLOR: #000000">k)</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> EOF )<br /><img id="Codehighlighter1_168_907_Open_Image" onclick="this.style.display='none'; Codehighlighter1_168_907_Open_Text.style.display='none'; Codehighlighter1_168_907_Closed_Image.style.display='inline'; Codehighlighter1_168_907_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_168_907_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_168_907_Closed_Text.style.display='none'; Codehighlighter1_168_907_Open_Image.style.display='inline'; Codehighlighter1_168_907_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_168_907_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_168_907_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</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 ) 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">d[i] );<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" />        memset( result, </span>
								<span style="COLOR: #0000ff">false</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(result) );<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" />        </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> t</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> d[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">?</span>
								<span style="COLOR: #000000"> ( d[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">]</span>
								<span style="COLOR: #000000">%</span>
								<span style="COLOR: #000000"> k ): ( (k</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">d[</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">k ); <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        result[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][t]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">true</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</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 /><img id="Codehighlighter1_445_777_Open_Image" onclick="this.style.display='none'; Codehighlighter1_445_777_Open_Text.style.display='none'; Codehighlighter1_445_777_Closed_Image.style.display='inline'; Codehighlighter1_445_777_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_445_777_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_445_777_Closed_Text.style.display='none'; Codehighlighter1_445_777_Open_Image.style.display='inline'; Codehighlighter1_445_777_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_445_777_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_445_777_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> t1</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> ( d[i]</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> )</span>
										<span style="COLOR: #000000">?</span>
										<span style="COLOR: #000000">(d[i]</span>
										<span style="COLOR: #000000">%</span>
										<span style="COLOR: #000000">k):(</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000">d[i]</span>
										<span style="COLOR: #000000">%</span>
										<span style="COLOR: #000000">k);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> t2</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> (k</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000"> t1)</span>
										<span style="COLOR: #000000">%</span>
										<span style="COLOR: #000000"> k;<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" />            </span>
										<span style="COLOR: #0000ff">for</span>
										<span style="COLOR: #000000"> ( </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> j</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">; j</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">101</span>
										<span style="COLOR: #000000">; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">j )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> ( result[i</span>
										<span style="COLOR: #000000">-</span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">][j] ) <br /><img id="Codehighlighter1_641_761_Open_Image" onclick="this.style.display='none'; Codehighlighter1_641_761_Open_Text.style.display='none'; Codehighlighter1_641_761_Closed_Image.style.display='inline'; Codehighlighter1_641_761_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_641_761_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_641_761_Closed_Text.style.display='none'; Codehighlighter1_641_761_Open_Image.style.display='inline'; Codehighlighter1_641_761_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
										<span id="Codehighlighter1_641_761_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_641_761_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    result[i][ (j</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> t1)</span>
												<span style="COLOR: #000000">%</span>
												<span style="COLOR: #000000"> k ]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">true</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    result[i][ (j</span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> t2)</span>
												<span style="COLOR: #000000">%</span>
												<span style="COLOR: #000000"> k ]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">true</span>
												<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
										</span>
										<span style="COLOR: #000000">     <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />         }</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" />         </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( result[n][</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">] ) printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Divisible\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />         </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">                printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Not divisible\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">        </span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63534.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-09 12:37 <a href="http://www.cppblog.com/Darren/archive/2008/10/09/63534.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku 1837  Balance</title><link>http://www.cppblog.com/Darren/archive/2008/10/09/63527.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 09 Oct 2008 03:14:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/09/63527.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63527.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/09/63527.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63527.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63527.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">stdlib.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">string</span>
				<span style="COLOR: #000000">.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  mid</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">5000</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  result[</span>
				<span style="COLOR: #000000">21</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">10000</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  C,G;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  pos[</span>
				<span style="COLOR: #000000">21</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  value[</span>
				<span style="COLOR: #000000">21</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_152_801_Open_Image" onclick="this.style.display='none'; Codehighlighter1_152_801_Open_Text.style.display='none'; Codehighlighter1_152_801_Closed_Image.style.display='inline'; Codehighlighter1_152_801_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_152_801_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_152_801_Closed_Text.style.display='none'; Codehighlighter1_152_801_Open_Image.style.display='inline'; Codehighlighter1_152_801_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_152_801_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_152_801_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d%d</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">C,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">G)</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> EOF )<br /><img id="Codehighlighter1_197_776_Open_Image" onclick="this.style.display='none'; Codehighlighter1_197_776_Open_Text.style.display='none'; Codehighlighter1_197_776_Closed_Image.style.display='inline'; Codehighlighter1_197_776_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_197_776_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_197_776_Closed_Text.style.display='none'; Codehighlighter1_197_776_Open_Image.style.display='inline'; Codehighlighter1_197_776_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_197_776_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_197_776_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> C; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )  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">pos[i] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> G; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )  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">value[i] );<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" />        memset( result, </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(result ) );<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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> C; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        result[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][ mid</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> pos[i]</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> value[</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">] ]</span>
								<span style="COLOR: #000000">++</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" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> i</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">2</span>
								<span style="COLOR: #000000">; i</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> G; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> j</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">; j</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> C; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </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">0</span>
								<span style="COLOR: #000000">; k</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">10000</span>
								<span style="COLOR: #000000">; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">k )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                   </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( result[i</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">][k]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                   result[i][ k</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> value[i]</span>
								<span style="COLOR: #000000">*</span>
								<span style="COLOR: #000000"> pos[j] ]</span>
								<span style="COLOR: #000000">+=</span>
								<span style="COLOR: #000000"> result[ i</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000"> ][k];<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" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">%d\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, result[G][mid] );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">    </span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63527.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-09 11:14 <a href="http://www.cppblog.com/Darren/archive/2008/10/09/63527.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku_1088    滑雪 </title><link>http://www.cppblog.com/Darren/archive/2008/10/03/63184.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Fri, 03 Oct 2008 04:29:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/03/63184.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63184.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/03/63184.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63184.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63184.html</trackback:ping><description><![CDATA[
		<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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#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 />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">limits</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> data[</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> resu[</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">];<br /><img id="Codehighlighter1_89_103_Open_Image" onclick="this.style.display='none'; Codehighlighter1_89_103_Open_Text.style.display='none'; Codehighlighter1_89_103_Closed_Image.style.display='inline'; Codehighlighter1_89_103_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_89_103_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_89_103_Closed_Text.style.display='none'; Codehighlighter1_89_103_Open_Image.style.display='inline'; Codehighlighter1_89_103_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> x[</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_89_103_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_89_103_Open_Text">
						<span style="COLOR: #000000">{ </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> }</span>
				</span>
				<span style="COLOR: #000000">;<br /><img id="Codehighlighter1_116_130_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_130_Open_Text.style.display='none'; Codehighlighter1_116_130_Closed_Image.style.display='inline'; Codehighlighter1_116_130_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_116_130_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_116_130_Closed_Text.style.display='none'; Codehighlighter1_116_130_Open_Image.style.display='inline'; Codehighlighter1_116_130_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> y[</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span id="Codehighlighter1_116_130_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_116_130_Open_Text">
						<span style="COLOR: #000000">{  </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000"> }</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> r,c;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> isok( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j )<br /><img id="Codehighlighter1_169_215_Open_Image" onclick="this.style.display='none'; Codehighlighter1_169_215_Open_Text.style.display='none'; Codehighlighter1_169_215_Closed_Image.style.display='inline'; Codehighlighter1_169_215_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_169_215_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_169_215_Closed_Text.style.display='none'; Codehighlighter1_169_215_Open_Image.style.display='inline'; Codehighlighter1_169_215_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_169_215_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_169_215_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> ( i</span>
						<span style="COLOR: #000000">&gt;=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> r </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">&gt;=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> c );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> DP( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> i, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> j )<br /><img id="Codehighlighter1_241_498_Open_Image" onclick="this.style.display='none'; Codehighlighter1_241_498_Open_Text.style.display='none'; Codehighlighter1_241_498_Closed_Image.style.display='inline'; Codehighlighter1_241_498_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_241_498_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_241_498_Closed_Text.style.display='none'; Codehighlighter1_241_498_Open_Image.style.display='inline'; Codehighlighter1_241_498_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_241_498_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_241_498_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</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" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> ( resu[i][j]</span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000"> ) </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> resu[i][j];<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" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> t</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; t</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">4</span>
						<span style="COLOR: #000000">; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">t )<br /><img id="Codehighlighter1_330_479_Open_Image" onclick="this.style.display='none'; Codehighlighter1_330_479_Open_Text.style.display='none'; Codehighlighter1_330_479_Closed_Image.style.display='inline'; Codehighlighter1_330_479_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_330_479_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_330_479_Closed_Text.style.display='none'; Codehighlighter1_330_479_Open_Image.style.display='inline'; Codehighlighter1_330_479_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_330_479_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_330_479_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" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( isok( i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> x[t], j</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> y[t] ) </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> data[ i</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> x[t] ][ j</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> y[t] ]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> data[i][j] )<br /><img id="Codehighlighter1_412_476_Open_Image" onclick="this.style.display='none'; Codehighlighter1_412_476_Open_Text.style.display='none'; Codehighlighter1_412_476_Closed_Image.style.display='inline'; Codehighlighter1_412_476_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_412_476_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_412_476_Closed_Text.style.display='none'; Codehighlighter1_412_476_Open_Image.style.display='inline'; Codehighlighter1_412_476_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_412_476_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_476_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000"> m</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> DP( i</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> x[t], j</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> y[t] );<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" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> ( m</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000"> max ) max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> m;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> max</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_512_853_Open_Image" onclick="this.style.display='none'; Codehighlighter1_512_853_Open_Text.style.display='none'; Codehighlighter1_512_853_Closed_Image.style.display='inline'; Codehighlighter1_512_853_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_512_853_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_512_853_Closed_Text.style.display='none'; Codehighlighter1_512_853_Open_Image.style.display='inline'; Codehighlighter1_512_853_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_512_853_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_512_853_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    scanf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d%d</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">r,</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">c);<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" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> r; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> c; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">j )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            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">data[i][j] );<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" />    memset( resu, </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">sizeof</span>
						<span style="COLOR: #000000">(resu) );<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" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> INT_MIN;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> r; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> j</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">; j</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> c; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">j )<br /><img id="Codehighlighter1_742_814_Open_Image" onclick="this.style.display='none'; Codehighlighter1_742_814_Open_Text.style.display='none'; Codehighlighter1_742_814_Closed_Image.style.display='inline'; Codehighlighter1_742_814_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_742_814_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_742_814_Closed_Text.style.display='none'; Codehighlighter1_742_814_Open_Image.style.display='inline'; Codehighlighter1_742_814_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
						<span id="Codehighlighter1_742_814_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_742_814_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            resu[i][j]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> DP(i,j);<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" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( max</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> resu[i][j] ) max</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> resu[i][j];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</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" />    printf(</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">%d\n</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, max );<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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</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/Darren/aggbug/63184.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-10-03 12:29 <a href="http://www.cppblog.com/Darren/archive/2008/10/03/63184.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>拦截导弹</title><link>http://www.cppblog.com/Darren/archive/2008/08/19/59356.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Tue, 19 Aug 2008 08:32:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/08/19/59356.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/59356.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/08/19/59356.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/59356.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/59356.html</trackback:ping><description><![CDATA[
		<p>Problem description<br /> <br />某国为了防御敌国的导弹袭击，发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷：虽然它的第一发炮弹能够到达任意的高度，但是以后每一发炮弹都不能高于前一发的高度。某天，雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段，所以只有一套系统，因此有可能不能拦截所有的导弹。</p>
		<p>
				<br />Input <br />输入数据为导弹依次飞来的高度，所有高度值均为不大于30000的正整数。</p>
		<p>
				<br />Output <br />输出只有一行是这套系统最多能拦截的导弹数和要拦截所有导弹最少要配备这种导弹拦截系统的套数。两个数据之间用一个空格隔开.</p>
		<p>
				<br />Sample Input <br />389 207 155 300 299 170 158 65<br /> <br />Sample Output <br />6 2<br /><br /><br />第一问显然是求最长不下降序列长度<br />第二问求最长上升序列长度<br /><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">
				<span style="COLOR: #008080"> 1</span>
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">#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"> 2</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />#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"> 3</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080"> 4</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">using</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">namespace</span>
				<span style="COLOR: #000000"> std;<br /></span>
				<span style="COLOR: #008080"> 5</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
						<br />
				</span>
				<span style="COLOR: #008080"> 6</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br /></span>
				<span style="COLOR: #008080"> 7</span>
				<span style="COLOR: #000000">
						<img id="Codehighlighter1_72_1230_Open_Image" onclick="this.style.display='none'; Codehighlighter1_72_1230_Open_Text.style.display='none'; Codehighlighter1_72_1230_Closed_Image.style.display='inline'; Codehighlighter1_72_1230_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
						<img id="Codehighlighter1_72_1230_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_72_1230_Closed_Text.style.display='none'; Codehighlighter1_72_1230_Open_Image.style.display='inline'; Codehighlighter1_72_1230_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				</span>
				<span id="Codehighlighter1_72_1230_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_72_1230_Open_Text">
						<span style="COLOR: #000000">{<br /></span>
						<span style="COLOR: #008080"> 8</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    vector</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">  a;<br /></span>
						<span style="COLOR: #008080"> 9</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">    data;<br /></span>
						<span style="COLOR: #008080">10</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">11</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000"> ( cin </span>
						<span style="COLOR: #000000">&gt;&gt;</span>
						<span style="COLOR: #000000"> data )<br /></span>
						<span style="COLOR: #008080">12</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        a.push_back( data );<br /></span>
						<span style="COLOR: #008080">13</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">14</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">   len</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> static_cast</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000">( a.size () );<br /></span>
						<span style="COLOR: #008080">15</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">  value</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">new</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">[len];<br /></span>
						<span style="COLOR: #008080">16</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">   max, t</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">17</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">18</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">19</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        value[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">20</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">21</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">22</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_361_614_Open_Image" onclick="this.style.display='none'; Codehighlighter1_361_614_Open_Text.style.display='none'; Codehighlighter1_361_614_Closed_Image.style.display='inline'; Codehighlighter1_361_614_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_361_614_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_361_614_Closed_Text.style.display='none'; Codehighlighter1_361_614_Open_Image.style.display='inline'; Codehighlighter1_361_614_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_361_614_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_361_614_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">23</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        max</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">24</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        t</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">25</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										<br />
								</span>
								<span style="COLOR: #008080">26</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> j</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; j</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> i; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )<br /></span>
								<span style="COLOR: #008080">27</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( a[i]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> a[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> value[j]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> max )<br /></span>
								<span style="COLOR: #008080">28</span>
								<span style="COLOR: #000000">
										<img id="Codehighlighter1_489_556_Open_Image" onclick="this.style.display='none'; Codehighlighter1_489_556_Open_Text.style.display='none'; Codehighlighter1_489_556_Closed_Image.style.display='inline'; Codehighlighter1_489_556_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_489_556_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_489_556_Closed_Text.style.display='none'; Codehighlighter1_489_556_Open_Image.style.display='inline'; Codehighlighter1_489_556_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_489_556_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_489_556_Open_Text">
										<span style="COLOR: #000000">{<br /></span>
										<span style="COLOR: #008080">29</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                t</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">;<br /></span>
										<span style="COLOR: #008080">30</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> value[j];<br /></span>
										<span style="COLOR: #008080">31</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
								</span>
								<span style="COLOR: #008080">32</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										<br />
								</span>
								<span style="COLOR: #008080">33</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( t</span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> )<br /></span>
								<span style="COLOR: #008080">34</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            value[i]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> max</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">35</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">36</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">37</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">38</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">39</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> ( value[i]</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> max )<br /></span>
						<span style="COLOR: #008080">40</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> value[i];<br /></span>
						<span style="COLOR: #008080">41</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">42</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cout </span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000"> max;<br /></span>
						<span style="COLOR: #008080">43</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">44</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">45</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        value[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">46</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">47</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">48</span>
						<span style="COLOR: #000000">
								<img id="Codehighlighter1_832_1085_Open_Image" onclick="this.style.display='none'; Codehighlighter1_832_1085_Open_Text.style.display='none'; Codehighlighter1_832_1085_Closed_Image.style.display='inline'; Codehighlighter1_832_1085_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_832_1085_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_832_1085_Closed_Text.style.display='none'; Codehighlighter1_832_1085_Open_Image.style.display='inline'; Codehighlighter1_832_1085_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_832_1085_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_832_1085_Open_Text">
								<span style="COLOR: #000000">{<br /></span>
								<span style="COLOR: #008080">49</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        max</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">50</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        t</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">51</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										<br />
								</span>
								<span style="COLOR: #008080">52</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">for</span>
								<span style="COLOR: #000000"> ( </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> j</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">; j</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> i; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )<br /></span>
								<span style="COLOR: #008080">53</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( a[i]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> a[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> value[j]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> max )<br /></span>
								<span style="COLOR: #008080">54</span>
								<span style="COLOR: #000000">
										<img id="Codehighlighter1_960_1027_Open_Image" onclick="this.style.display='none'; Codehighlighter1_960_1027_Open_Text.style.display='none'; Codehighlighter1_960_1027_Closed_Image.style.display='inline'; Codehighlighter1_960_1027_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_960_1027_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_960_1027_Closed_Text.style.display='none'; Codehighlighter1_960_1027_Open_Image.style.display='inline'; Codehighlighter1_960_1027_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_960_1027_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_960_1027_Open_Text">
										<span style="COLOR: #000000">{<br /></span>
										<span style="COLOR: #008080">55</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                t</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">1</span>
										<span style="COLOR: #000000">;<br /></span>
										<span style="COLOR: #008080">56</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> value[j];<br /></span>
										<span style="COLOR: #008080">57</span>
										<span style="COLOR: #000000">
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
								</span>
								<span style="COLOR: #008080">58</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										<br />
								</span>
								<span style="COLOR: #008080">59</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> ( t</span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> )<br /></span>
								<span style="COLOR: #008080">60</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            value[i]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> max</span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">;<br /></span>
								<span style="COLOR: #008080">61</span>
								<span style="COLOR: #000000">
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
						</span>
						<span style="COLOR: #008080">62</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">63</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">64</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">for</span>
						<span style="COLOR: #000000"> ( </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> i</span>
						<span style="COLOR: #000000">=</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"> len; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /></span>
						<span style="COLOR: #008080">65</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> ( value[i]</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> max )<br /></span>
						<span style="COLOR: #008080">66</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> value[i];<br /></span>
						<span style="COLOR: #008080">67</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">68</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cout </span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">'</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">'</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&lt;&lt;</span>
						<span style="COLOR: #000000"> max;<br /></span>
						<span style="COLOR: #008080">69</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
						</span>
						<span style="COLOR: #008080">70</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /></span>
						<span style="COLOR: #008080">71</span>
						<span style="COLOR: #000000">
								<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #008080">72</span>
				<span style="COLOR: #000000">
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<br />
		<br />
		<br />
		<br />
<img src ="http://www.cppblog.com/Darren/aggbug/59356.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Darren/" target="_blank">Darren</a> 2008-08-19 16:32 <a href="http://www.cppblog.com/Darren/archive/2008/08/19/59356.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>