﻿<?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/12419.html</link><description>C++ 及算法</description><language>zh-cn</language><lastBuildDate>Fri, 27 Nov 2009 14:01:46 GMT</lastBuildDate><pubDate>Fri, 27 Nov 2009 14:01:46 GMT</pubDate><ttl>60</ttl><item><title>Pku   3169  Layout</title><link>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 20 Jul 2009 11:55:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90649.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/20/90649.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90649.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90649.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">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#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 />#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 />
						<br />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 1005</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> inf 1&lt;&lt;29</span>
				<span style="COLOR: #000000">
						<br />
						<br />
				</span>
				<span style="COLOR: #0000ff">struct</span>
				<span style="COLOR: #000000"> Edge{<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    Edge( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> a</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">int</span>
				<span style="COLOR: #000000"> b</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">int</span>
				<span style="COLOR: #000000"> c</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> ):<br />        u(a), v(b), d(c) {}<br />};<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> n, ml, md, s</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">;<br />Edge  ege[</span>
				<span style="COLOR: #000000">20010</span>
				<span style="COLOR: #000000">];<br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> dist[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> bell_man(){<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">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 ) dist[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> inf;<br />    dist[</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 />    <br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> flag</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: #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 ){<br />        flag</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: #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"> s; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">j ){<br />            </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].u, v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].v, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> ege[j].d;<br />            </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( dist[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000"> dist[v] ) dist[v]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dist[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w, flag</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">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">flag ) </span>
				<span style="COLOR: #0000ff">break</span>
				<span style="COLOR: #000000">;<br />    }<br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( flag ) </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 />    </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( dist[n]</span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000"> inf ) </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">;<br />    </span>
				<span style="COLOR: #0000ff">else</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> dist[n];<br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">n,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">ml,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">md );<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( ml</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d );<br />        ege[s</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> Edge( u, v, d );<br />    }<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( md</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d );<br />        ege[s</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> Edge( v, u, </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000">d );<br />    }<br />    printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, bell_man() );<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/90649.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-20 19:55 <a href="http://www.cppblog.com/Darren/archive/2009/07/20/90649.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1986  Distance Queries</title><link>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Mon, 20 Jul 2009 02:56:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/90590.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2009/07/20/90590.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/90590.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/90590.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 />#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 />
						<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 40010</span>
				<span style="COLOR: #000000">
						<br />typedef pair</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> PAIR;<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> m, n;<br />vector</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">PAIR</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> query[N], map[N];<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> uset[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, acs[N], flag[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, dis[N]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">}, ans[N], visite[N]</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">int</span>
				<span style="COLOR: #000000"> find( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> x ){<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( x</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000"> uset[x] ) x</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> uset[x];<br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> x; }<br /><br /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> join( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> x, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> y ){  uset[ find(x) ]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> uset[ find(y) ]; }<br /><br /></span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> dfs( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> d ){<br />    uset[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u; acs[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u; dis[u]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> d; visite[u]</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: #0000ff">for</span>
				<span style="COLOR: #000000">( size_t 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"> map[u].size(); </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> map[u][i].first, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> map[u][i].second;<br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">visite[v] ){<br />            dfs( v, d</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> w );<br />            join( u, v ); acs[ find(u) ]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> u;  }<br />    }<br />    <br />    flag[u]</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: #0000ff">for</span>
				<span style="COLOR: #000000">( size_t 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"> query[u].size(); </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ){<br />        </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> v</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> query[u][i].first, w</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> query[u][i].second;<br />        <br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( flag[v] ) ans[w]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> dis[u]</span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> dis[v]</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"> dis[ acs[ find(v) ] ];<br />    }    <br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main(){<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> u, v, d;<br />    </span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000"> s[</span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">];<br />    <br />    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">m);<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( m</span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000"> ){<br />        scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d%d%d%s</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">d,s );<br />        map[u].push_back( PAIR(v,d) );<br />        map[v].push_back( PAIR(u,d) );<br />    }<br />    <br />    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 );<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">1</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 />        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">u,</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000">v );<br />        query[u].push_back( PAIR(v,i) );<br />        query[v].push_back( PAIR(u,i) );<br />    }<br />    memset( flag, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(flag) );<br />    memset( visite, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(visite) );<br />    <br />    dfs( </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> ); <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">1</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 ) printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%d\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, ans[i] );<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/90590.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-20 10:56 <a href="http://www.cppblog.com/Darren/archive/2009/07/20/90590.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1258   Agri-Net</title><link>http://www.cppblog.com/Darren/archive/2008/11/05/66039.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 05 Nov 2008 08:30:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/11/05/66039.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/66039.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/11/05/66039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/66039.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/66039.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: #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" />#include </span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #000000">limits.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">#define</span>
				<span style="COLOR: #000000">  N  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" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  n,result;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  map[N][N];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> visite[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">  dis[N];<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">void</span>
				<span style="COLOR: #000000">  Prim()<br /><img id="Codehighlighter1_151_572_Open_Image" onclick="this.style.display='none'; Codehighlighter1_151_572_Open_Text.style.display='none'; Codehighlighter1_151_572_Closed_Image.style.display='inline'; Codehighlighter1_151_572_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_151_572_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_151_572_Closed_Text.style.display='none'; Codehighlighter1_151_572_Open_Image.style.display='inline'; Codehighlighter1_151_572_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_151_572_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_151_572_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    memset( visite, </span>
						<span style="COLOR: #0000ff">false</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">sizeof</span>
						<span style="COLOR: #000000">(visite) );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    visite[</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: #0000ff">true</span>
						<span style="COLOR: #000000">;  result</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">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 )  dis[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> map[</span>
						<span style="COLOR: #000000">0</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" />    </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 )<br /><img id="Codehighlighter1_306_570_Open_Image" onclick="this.style.display='none'; Codehighlighter1_306_570_Open_Text.style.display='none'; Codehighlighter1_306_570_Closed_Image.style.display='inline'; Codehighlighter1_306_570_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_306_570_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_306_570_Closed_Text.style.display='none'; Codehighlighter1_306_570_Open_Image.style.display='inline'; Codehighlighter1_306_570_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_306_570_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_306_570_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"> min</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> INT_MAX, 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"> n; </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">( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> dis[j]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> min ) min</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> dis[j], k</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> 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" />        visite[k]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">true</span>
								<span style="COLOR: #000000">;  result</span>
								<span style="COLOR: #000000">+=</span>
								<span style="COLOR: #000000"> dis[k];<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 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">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> map[k][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"> map[k][j]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> dis[j] ) <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />              dis[j]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> map[k][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/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_586_774_Open_Image" onclick="this.style.display='none'; Codehighlighter1_586_774_Open_Text.style.display='none'; Codehighlighter1_586_774_Closed_Image.style.display='inline'; Codehighlighter1_586_774_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_586_774_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_586_774_Closed_Text.style.display='none'; Codehighlighter1_586_774_Open_Image.style.display='inline'; Codehighlighter1_586_774_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_586_774_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_586_774_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_620_759_Open_Image" onclick="this.style.display='none'; Codehighlighter1_620_759_Open_Text.style.display='none'; Codehighlighter1_620_759_Closed_Image.style.display='inline'; Codehighlighter1_620_759_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_620_759_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_620_759_Closed_Text.style.display='none'; Codehighlighter1_620_759_Open_Image.style.display='inline'; Codehighlighter1_620_759_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_620_759_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_620_759_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 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 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">map[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" />        Prim();<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 );<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" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/66039.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-05 16:30 <a href="http://www.cppblog.com/Darren/archive/2008/11/05/66039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1047  Round and Round We Go</title><link>http://www.cppblog.com/Darren/archive/2008/10/30/65580.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 30 Oct 2008 13:16:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/30/65580.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65580.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/30/65580.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65580.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65580.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">stdio.h</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000">
						<br />#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 />#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 />
						<br />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">   visite[</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">];<br /></span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000">  str[</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">];<br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">   d[</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">];<br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">   len;<br /><br /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> multi( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> n )<br />{<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> t[</span>
				<span style="COLOR: #000000">100</span>
				<span style="COLOR: #000000">];<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> v[</span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">];<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"> len; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) t[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> d[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"> </span>
				<span style="COLOR: #000000">15</span>
				<span style="COLOR: #000000">; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i  ) v[i]</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> visite[i];<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"> len; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i )<br />    t[i]</span>
				<span style="COLOR: #000000">*=</span>
				<span style="COLOR: #000000"> n;<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"> 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 />    {<br />        t[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"> t[i]</span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">;<br />        t[i]</span>
				<span style="COLOR: #000000">%=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">;<br />    }<br />    <br />    </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( t[</span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">]</span>
				<span style="COLOR: #000000">&gt;=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000"> ) </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">false</span>
				<span style="COLOR: #000000">;<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"> len; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i )  </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">--</span>
				<span style="COLOR: #000000">v[ t[i] ]</span>
				<span style="COLOR: #000000">&lt;</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"> </span>
				<span style="COLOR: #0000ff">false</span>
				<span style="COLOR: #000000">;<br />    <br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">true</span>
				<span style="COLOR: #000000">;<br />}<br /><br /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000"> isok()<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">2</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: #0000ff">if</span>
				<span style="COLOR: #000000">( </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000">multi( i ) ) </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">false</span>
				<span style="COLOR: #000000">;<br />    <br />    </span>
				<span style="COLOR: #0000ff">return</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">true</span>
				<span style="COLOR: #000000">;<br />}<br /><br /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> main()<br />{<br />    </span>
				<span style="COLOR: #0000ff">while</span>
				<span style="COLOR: #000000">( scanf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%s</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,str)</span>
				<span style="COLOR: #000000">!=</span>
				<span style="COLOR: #000000"> EOF )<br />    {<br />        len</span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> strlen( str );  <br />        memset( visite, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #0000ff">sizeof</span>
				<span style="COLOR: #000000">(visite) );<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"> len; </span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">i ) { d[i]</span>
				<span style="COLOR: #000000">=</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">0</span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">; visite[ d[i] ]</span>
				<span style="COLOR: #000000">++</span>
				<span style="COLOR: #000000">; }<br />        <br />        </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000">( isok() ) printf(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">%s is cyclic\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, str );<br />        </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 cyclic\n</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, str );<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/65580.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 21:16 <a href="http://www.cppblog.com/Darren/archive/2008/10/30/65580.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku 1089  Intervals</title><link>http://www.cppblog.com/Darren/archive/2008/10/29/65487.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 29 Oct 2008 15:01:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/29/65487.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65487.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/29/65487.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65487.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65487.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" />
						<br />
						<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">#define</span>
				<span style="COLOR: #000000"> N 50001</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"> Node<br /><img id="Codehighlighter1_69_82_Open_Image" onclick="this.style.display='none'; Codehighlighter1_69_82_Open_Text.style.display='none'; Codehighlighter1_69_82_Closed_Image.style.display='inline'; Codehighlighter1_69_82_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_69_82_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_69_82_Closed_Text.style.display='none'; Codehighlighter1_69_82_Open_Image.style.display='inline'; Codehighlighter1_69_82_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_69_82_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_69_82_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, b;<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" />Node d[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">  n;<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"> cmp( </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000"> a, </span>
				<span style="COLOR: #0000ff">const</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000"> b )<br /><img id="Codehighlighter1_146_258_Open_Image" onclick="this.style.display='none'; Codehighlighter1_146_258_Open_Text.style.display='none'; Codehighlighter1_146_258_Closed_Image.style.display='inline'; Codehighlighter1_146_258_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_146_258_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_146_258_Closed_Text.style.display='none'; Codehighlighter1_146_258_Open_Image.style.display='inline'; Codehighlighter1_146_258_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_146_258_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_146_258_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    Node</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000"> ta</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> (Node</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">)a;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    Node</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000"> tb</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> (Node</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" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">( ta</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">a</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> tb</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">a ) </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> ta</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">b</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> tb</span>
						<span style="COLOR: #000000">-&gt;</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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> ta</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">a</span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000"> tb</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">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_272_635_Open_Image" onclick="this.style.display='none'; Codehighlighter1_272_635_Open_Text.style.display='none'; Codehighlighter1_272_635_Closed_Image.style.display='inline'; Codehighlighter1_272_635_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_272_635_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_272_635_Closed_Text.style.display='none'; Codehighlighter1_272_635_Open_Image.style.display='inline'; Codehighlighter1_272_635_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_272_635_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_272_635_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 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 )  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">d[i].a, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">d[i].b );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    qsort( d, n, </span>
						<span style="COLOR: #0000ff">sizeof</span>
						<span style="COLOR: #000000">( d[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">] ), cmp );<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"> min</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> d[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">].a, max</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> d[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">].b;<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 )<br /><img id="Codehighlighter1_456_588_Open_Image" onclick="this.style.display='none'; Codehighlighter1_456_588_Open_Text.style.display='none'; Codehighlighter1_456_588_Closed_Image.style.display='inline'; Codehighlighter1_456_588_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_456_588_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_456_588_Closed_Text.style.display='none'; Codehighlighter1_456_588_Open_Image.style.display='inline'; Codehighlighter1_456_588_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_456_588_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_456_588_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">( d[i].a</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> max )<br /><img id="Codehighlighter1_480_547_Open_Image" onclick="this.style.display='none'; Codehighlighter1_480_547_Open_Text.style.display='none'; Codehighlighter1_480_547_Closed_Image.style.display='inline'; Codehighlighter1_480_547_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_480_547_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_480_547_Closed_Text.style.display='none'; Codehighlighter1_480_547_Open_Image.style.display='inline'; Codehighlighter1_480_547_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_480_547_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_480_547_Open_Text">
										<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 %d\n</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">, min, max );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            min</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> d[i].a, max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> d[i].b;<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">if</span>
								<span style="COLOR: #000000">( d[i].b</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> max ) max</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> d[i].b;<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">%d %d\n</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">, min, 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>
				<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/65487.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 23:01 <a href="http://www.cppblog.com/Darren/archive/2008/10/29/65487.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1062   昂贵的聘礼</title><link>http://www.cppblog.com/Darren/archive/2008/10/29/65475.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 29 Oct 2008 13:01:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/29/65475.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/65475.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/29/65475.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/65475.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/65475.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">limits.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: #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" />#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">#define</span>
				<span style="COLOR: #000000"> N 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" />
				</span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> graph[N][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"> rank[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"> value[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"> m, n, len;<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">  findrank( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> t )<br /><img id="Codehighlighter1_197_277_Open_Image" onclick="this.style.display='none'; Codehighlighter1_197_277_Open_Text.style.display='none'; Codehighlighter1_197_277_Closed_Image.style.display='inline'; Codehighlighter1_197_277_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_197_277_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_197_277_Closed_Text.style.display='none'; Codehighlighter1_197_277_Open_Image.style.display='inline'; Codehighlighter1_197_277_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_197_277_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_277_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"> t; </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">( value[i]</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> t ) </span>
						<span style="COLOR: #0000ff">return</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">return</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/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"> dis( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> Rank )<br /><img id="Codehighlighter1_300_1042_Open_Image" onclick="this.style.display='none'; Codehighlighter1_300_1042_Open_Text.style.display='none'; Codehighlighter1_300_1042_Closed_Image.style.display='inline'; Codehighlighter1_300_1042_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_300_1042_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_300_1042_Closed_Text.style.display='none'; Codehighlighter1_300_1042_Open_Image.style.display='inline'; Codehighlighter1_300_1042_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_300_1042_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_300_1042_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"> visite[N];<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[N];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    rank[</span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> Rank;<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"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i ) <br /><img id="Codehighlighter1_385_546_Open_Image" onclick="this.style.display='none'; Codehighlighter1_385_546_Open_Text.style.display='none'; Codehighlighter1_385_546_Closed_Image.style.display='inline'; Codehighlighter1_385_546_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_385_546_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_385_546_Closed_Text.style.display='none'; Codehighlighter1_385_546_Open_Image.style.display='inline'; Codehighlighter1_385_546_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_385_546_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_385_546_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"> Rank</span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> rank[i];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        <br /><img id="Codehighlighter1_437_482_Open_Image" onclick="this.style.display='none'; Codehighlighter1_437_482_Open_Text.style.display='none'; Codehighlighter1_437_482_Closed_Image.style.display='inline'; Codehighlighter1_437_482_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_437_482_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_437_482_Closed_Text.style.display='none'; Codehighlighter1_437_482_Open_Image.style.display='inline'; Codehighlighter1_437_482_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">( t</span>
								<span style="COLOR: #000000">&lt;=</span>
								<span style="COLOR: #000000"> m </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> t</span>
								<span style="COLOR: #000000">&gt;=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> ) </span>
								<span id="Codehighlighter1_437_482_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_437_482_Open_Text">
										<span style="COLOR: #000000">{ visite[i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">false</span>
										<span style="COLOR: #000000">;  result[i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> graph[</span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000">][i]; }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_507_543_Open_Image" onclick="this.style.display='none'; Codehighlighter1_507_543_Open_Text.style.display='none'; Codehighlighter1_507_543_Closed_Image.style.display='inline'; Codehighlighter1_507_543_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_507_543_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_507_543_Closed_Text.style.display='none'; Codehighlighter1_507_543_Open_Image.style.display='inline'; Codehighlighter1_507_543_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">                 </span>
								<span id="Codehighlighter1_507_543_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_543_Open_Text">
										<span style="COLOR: #000000">{ visite[i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">true</span>
										<span style="COLOR: #000000">;   result[i]</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>
								<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" />    visite[</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: #0000ff">true</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"> 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"> n; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">t )<br /><img id="Codehighlighter1_598_1019_Open_Image" onclick="this.style.display='none'; Codehighlighter1_598_1019_Open_Text.style.display='none'; Codehighlighter1_598_1019_Closed_Image.style.display='inline'; Codehighlighter1_598_1019_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_598_1019_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_598_1019_Closed_Text.style.display='none'; Codehighlighter1_598_1019_Open_Image.style.display='inline'; Codehighlighter1_598_1019_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_598_1019_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_598_1019_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">  min</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> INT_MAX;<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"> 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">( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[i] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> result[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"> result[i]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> min  )<br /><img id="Codehighlighter1_731_763_Open_Image" onclick="this.style.display='none'; Codehighlighter1_731_763_Open_Text.style.display='none'; Codehighlighter1_731_763_Closed_Image.style.display='inline'; Codehighlighter1_731_763_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_731_763_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_731_763_Closed_Text.style.display='none'; Codehighlighter1_731_763_Open_Image.style.display='inline'; Codehighlighter1_731_763_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_731_763_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_731_763_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"> result[i];<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/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">if</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"> ) </span>
								<span style="COLOR: #0000ff">break</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" />        visite[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" />        </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 )<br /><img id="Codehighlighter1_841_1015_Open_Image" onclick="this.style.display='none'; Codehighlighter1_841_1015_Open_Text.style.display='none'; Codehighlighter1_841_1015_Closed_Image.style.display='inline'; Codehighlighter1_841_1015_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_841_1015_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_841_1015_Closed_Text.style.display='none'; Codehighlighter1_841_1015_Open_Image.style.display='inline'; Codehighlighter1_841_1015_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_841_1015_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_841_1015_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">( </span>
										<span style="COLOR: #000000">!</span>
										<span style="COLOR: #000000">visite[i] </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000">  graph[k][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"> result[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" />                        </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> ( result[k]</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> graph[k][i]</span>
										<span style="COLOR: #000000">&lt;</span>
										<span style="COLOR: #000000"> result[i] </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">-</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"> result[k]</span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> graph[k][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" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> result[</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_1056_1574_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1056_1574_Open_Text.style.display='none'; Codehighlighter1_1056_1574_Closed_Image.style.display='inline'; Codehighlighter1_1056_1574_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1056_1574_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1056_1574_Closed_Text.style.display='none'; Codehighlighter1_1056_1574_Open_Image.style.display='inline'; Codehighlighter1_1056_1574_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_1056_1574_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_1056_1574_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">m, </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" />    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" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    memset( graph, </span>
						<span style="COLOR: #000000">-</span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">sizeof</span>
						<span style="COLOR: #000000">(</span>
						<span style="COLOR: #0000ff">int</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">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">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 )<br /><img id="Codehighlighter1_1164_1405_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1164_1405_Open_Text.style.display='none'; Codehighlighter1_1164_1405_Closed_Image.style.display='inline'; Codehighlighter1_1164_1405_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1164_1405_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1164_1405_Closed_Text.style.display='none'; Codehighlighter1_1164_1405_Open_Image.style.display='inline'; Codehighlighter1_1164_1405_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_1164_1405_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_1164_1405_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"> va, ra, nn;<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">%d%d%d</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">va, </span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">ra, </span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">nn );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        graph[</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">][i]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> va;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        rank[i]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> ra;<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">findrank( ra ) ) value[len</span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> ra;<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"> nn; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">j )<br /><img id="Codehighlighter1_1336_1402_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1336_1402_Open_Text.style.display='none'; Codehighlighter1_1336_1402_Closed_Image.style.display='inline'; Codehighlighter1_1336_1402_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1336_1402_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1336_1402_Closed_Text.style.display='none'; Codehighlighter1_1336_1402_Open_Image.style.display='inline'; Codehighlighter1_1336_1402_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_1336_1402_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_1336_1402_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, b;<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">a, </span>
										<span style="COLOR: #000000">&amp;</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" />            graph[a][i]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> b;<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"> min</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> INT_MAX;<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_1461_1532_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1461_1532_Open_Text.style.display='none'; Codehighlighter1_1461_1532_Closed_Image.style.display='inline'; Codehighlighter1_1461_1532_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1461_1532_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1461_1532_Closed_Text.style.display='none'; Codehighlighter1_1461_1532_Open_Image.style.display='inline'; Codehighlighter1_1461_1532_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
						<span id="Codehighlighter1_1461_1532_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_1461_1532_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"> dis( 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" />            </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">( t</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> min </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> t</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"> ) min</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/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">, min );<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/65475.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 21:01 <a href="http://www.cppblog.com/Darren/archive/2008/10/29/65475.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Pku  1094  Sorting It All Out</title><link>http://www.cppblog.com/Darren/archive/2008/10/03/63175.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 02 Oct 2008 17:35:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/03/63175.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63175.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/03/63175.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63175.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63175.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">stack</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">vector</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, m;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">   degree[</span>
				<span style="COLOR: #000000">26</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">   data[</span>
				<span style="COLOR: #000000">26</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">26</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">  exist[</span>
				<span style="COLOR: #000000">26</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" />std::vector</span>
				<span style="COLOR: #000000">&lt;</span>
				<span style="COLOR: #0000ff">char</span>
				<span style="COLOR: #000000">&gt;</span>
				<span style="COLOR: #000000"> re;<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"> length()<br /><img id="Codehighlighter1_160_246_Open_Image" onclick="this.style.display='none'; Codehighlighter1_160_246_Open_Text.style.display='none'; Codehighlighter1_160_246_Closed_Image.style.display='inline'; Codehighlighter1_160_246_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_160_246_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_160_246_Closed_Text.style.display='none'; Codehighlighter1_160_246_Open_Image.style.display='inline'; Codehighlighter1_160_246_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_160_246_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_160_246_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"> num</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"> ( exist[i] )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            num</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">return</span>
						<span style="COLOR: #000000"> num;<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"> toplogicalsort()<br /><img id="Codehighlighter1_270_872_Open_Image" onclick="this.style.display='none'; Codehighlighter1_270_872_Open_Text.style.display='none'; Codehighlighter1_270_872_Closed_Image.style.display='inline'; Codehighlighter1_270_872_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_270_872_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_270_872_Closed_Text.style.display='none'; Codehighlighter1_270_872_Open_Image.style.display='inline'; Codehighlighter1_270_872_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_270_872_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_270_872_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    std::stack</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #0000ff">char</span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> st;<br /><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"> d</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">[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" />    re.clear ();<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"> 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" />        d[i]</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> degree[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"> 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"> ( d[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: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> exist[i] )st.push(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">bool</span>
						<span style="COLOR: #000000"> ok</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" />    </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">( </span>
						<span style="COLOR: #000000">!</span>
						<span style="COLOR: #000000">st.empty() )<br /><img id="Codehighlighter1_490_719_Open_Image" onclick="this.style.display='none'; Codehighlighter1_490_719_Open_Text.style.display='none'; Codehighlighter1_490_719_Closed_Image.style.display='inline'; Codehighlighter1_490_719_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_490_719_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_490_719_Closed_Text.style.display='none'; Codehighlighter1_490_719_Open_Image.style.display='inline'; Codehighlighter1_490_719_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_490_719_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_490_719_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"> ( (</span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000">)st.size ()</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000"> )  ok</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" /><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"> st.top ();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        st.pop();<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" />        re.push_back ( t</span>
								<span style="COLOR: #000000">+</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"> );<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"> 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"> ( data[i][t]</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"> exist[i] )<br /><img id="Codehighlighter1_664_716_Open_Image" onclick="this.style.display='none'; Codehighlighter1_664_716_Open_Text.style.display='none'; Codehighlighter1_664_716_Closed_Image.style.display='inline'; Codehighlighter1_664_716_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_664_716_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_664_716_Closed_Text.style.display='none'; Codehighlighter1_664_716_Open_Image.style.display='inline'; Codehighlighter1_664_716_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_664_716_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_664_716_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                d[i]</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"> ( d[i]</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> )   st.push (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" />    </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> len</span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> length();<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: #0000ff">int</span>
						<span style="COLOR: #000000">)re.size ()</span>
						<span style="COLOR: #000000">&lt;</span>
						<span style="COLOR: #000000"> len ) </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">2</span>
						<span style="COLOR: #000000">;   </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> exit circle</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</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"> ( </span>
						<span style="COLOR: #000000">!</span>
						<span style="COLOR: #000000">ok ) </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">if</span>
						<span style="COLOR: #000000"> ( (</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">)re.size ()</span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> n )  </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" /><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" />
						<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_886_2032_Open_Image" onclick="this.style.display='none'; Codehighlighter1_886_2032_Open_Text.style.display='none'; Codehighlighter1_886_2032_Closed_Image.style.display='inline'; Codehighlighter1_886_2032_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_886_2032_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_886_2032_Closed_Text.style.display='none'; Codehighlighter1_886_2032_Open_Image.style.display='inline'; Codehighlighter1_886_2032_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_886_2032_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_886_2032_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">m), m</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000"> n</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_929_2018_Open_Image" onclick="this.style.display='none'; Codehighlighter1_929_2018_Open_Text.style.display='none'; Codehighlighter1_929_2018_Closed_Image.style.display='inline'; Codehighlighter1_929_2018_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_929_2018_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_929_2018_Closed_Text.style.display='none'; Codehighlighter1_929_2018_Open_Image.style.display='inline'; Codehighlighter1_929_2018_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_929_2018_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_929_2018_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        memset( degree, </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(degree) );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        memset( data,   </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(data  ) );<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        memset( exist,  </span>
								<span style="COLOR: #0000ff">false</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(exist) );<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">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" />        </span>
								<span style="COLOR: #0000ff">bool</span>
								<span style="COLOR: #000000"> determin</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" />        getchar();<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"> m; </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000"> i )<br /><img id="Codehighlighter1_1143_1933_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1143_1933_Open_Text.style.display='none'; Codehighlighter1_1143_1933_Closed_Image.style.display='inline'; Codehighlighter1_1143_1933_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1143_1933_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1143_1933_Closed_Text.style.display='none'; Codehighlighter1_1143_1933_Open_Image.style.display='inline'; Codehighlighter1_1143_1933_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_1143_1933_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_1143_1933_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 src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            a</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> getchar();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            getchar();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            b</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> getchar();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            getchar();<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" />            exist[a</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: #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" />            exist[b</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: #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">if</span>
										<span style="COLOR: #000000"> (  </span>
										<span style="COLOR: #000000">!</span>
										<span style="COLOR: #000000">determin </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> isok </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> (data[a</span>
										<span style="COLOR: #000000">-</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">][b</span>
										<span style="COLOR: #000000">-</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: #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"> a</span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> b)  )<br /><img id="Codehighlighter1_1342_1426_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1342_1426_Open_Text.style.display='none'; Codehighlighter1_1342_1426_Closed_Image.style.display='inline'; Codehighlighter1_1342_1426_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1342_1426_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1342_1426_Closed_Text.style.display='none'; Codehighlighter1_1342_1426_Open_Image.style.display='inline'; Codehighlighter1_1342_1426_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_1342_1426_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_1342_1426_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" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                printf(</span>
												<span style="COLOR: #000000">"</span>
												<span style="COLOR: #000000">Inconsistency found after %d relations.\n</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" />            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> ( data[b</span>
										<span style="COLOR: #000000">-</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">][a</span>
										<span style="COLOR: #000000">-</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: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">0</span>
										<span style="COLOR: #000000"> ) degree[b</span>
										<span style="COLOR: #000000">-</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: #000000">++</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            data[b</span>
										<span style="COLOR: #000000">-</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">][a</span>
										<span style="COLOR: #000000">-</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: #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">int</span>
										<span style="COLOR: #000000"> type;<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">determin </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> isok </span>
										<span style="COLOR: #000000">&amp;&amp;</span>
										<span style="COLOR: #000000"> (type</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> toplogicalsort())  )<br /><img id="Codehighlighter1_1584_1929_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1584_1929_Open_Text.style.display='none'; Codehighlighter1_1584_1929_Closed_Image.style.display='inline'; Codehighlighter1_1584_1929_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1584_1929_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1584_1929_Closed_Text.style.display='none'; Codehighlighter1_1584_1929_Open_Image.style.display='inline'; Codehighlighter1_1584_1929_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_1584_1929_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_1584_1929_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"> ( type</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_1610_1806_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1610_1806_Open_Text.style.display='none'; Codehighlighter1_1610_1806_Closed_Image.style.display='inline'; Codehighlighter1_1610_1806_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1610_1806_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1610_1806_Closed_Text.style.display='none'; Codehighlighter1_1610_1806_Open_Image.style.display='inline'; Codehighlighter1_1610_1806_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span id="Codehighlighter1_1610_1806_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_1610_1806_Open_Text">
														<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    determin</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" />                    printf(</span>
														<span style="COLOR: #000000">"</span>
														<span style="COLOR: #000000">Sorted sequence determined after %d relations: </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"> ( size_t x</span>
														<span style="COLOR: #000000">=</span>
														<span style="COLOR: #000000"> </span>
														<span style="COLOR: #000000">0</span>
														<span style="COLOR: #000000">; x</span>
														<span style="COLOR: #000000">&lt;</span>
														<span style="COLOR: #000000"> re.size (); </span>
														<span style="COLOR: #000000">++</span>
														<span style="COLOR: #000000">x )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        printf(</span>
														<span style="COLOR: #000000">"</span>
														<span style="COLOR: #000000">%c</span>
														<span style="COLOR: #000000">"</span>
														<span style="COLOR: #000000">, re[x] );<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"> </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000"> ( type</span>
												<span style="COLOR: #000000">==</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">2</span>
												<span style="COLOR: #000000"> )<br /><img id="Codehighlighter1_1837_1924_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1837_1924_Open_Text.style.display='none'; Codehighlighter1_1837_1924_Closed_Image.style.display='inline'; Codehighlighter1_1837_1924_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1837_1924_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1837_1924_Closed_Text.style.display='none'; Codehighlighter1_1837_1924_Open_Image.style.display='inline'; Codehighlighter1_1837_1924_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span id="Codehighlighter1_1837_1924_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_1837_1924_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" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    printf(</span>
														<span style="COLOR: #000000">"</span>
														<span style="COLOR: #000000">Inconsistency found after %d relations.\n</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/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">determin </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> isok ) printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Sorted sequence cannot be determined.\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>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63175.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 01:35 <a href="http://www.cppblog.com/Darren/archive/2008/10/03/63175.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>pku  1797  Heavy Transportation</title><link>http://www.cppblog.com/Darren/archive/2008/10/02/63160.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 02 Oct 2008 09:39:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/02/63160.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63160.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/02/63160.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63160.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63160.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">algorithm</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">  n,m;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  graph[</span>
				<span style="COLOR: #000000">1001</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">1001</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"> visite[</span>
				<span style="COLOR: #000000">1001</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">1001</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">void</span>
				<span style="COLOR: #000000"> shortpath()<br /><img id="Codehighlighter1_150_675_Open_Image" onclick="this.style.display='none'; Codehighlighter1_150_675_Open_Text.style.display='none'; Codehighlighter1_150_675_Closed_Image.style.display='inline'; Codehighlighter1_150_675_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_150_675_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_150_675_Closed_Text.style.display='none'; Codehighlighter1_150_675_Open_Image.style.display='inline'; Codehighlighter1_150_675_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_150_675_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_150_675_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    memset( visite, </span>
						<span style="COLOR: #0000ff">false</span>
						<span style="COLOR: #000000">, </span>
						<span style="COLOR: #0000ff">sizeof</span>
						<span style="COLOR: #000000">(visite) );<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" />    visite[</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: #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">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 )<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"> graph[</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" />    </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 )<br /><img id="Codehighlighter1_340_672_Open_Image" onclick="this.style.display='none'; Codehighlighter1_340_672_Open_Text.style.display='none'; Codehighlighter1_340_672_Closed_Image.style.display='inline'; Codehighlighter1_340_672_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_340_672_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_340_672_Closed_Text.style.display='none'; Codehighlighter1_340_672_Open_Image.style.display='inline'; Codehighlighter1_340_672_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_340_672_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_340_672_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" />        </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"> 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"> n; </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"> ( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> result[j]</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> max )<br /><img id="Codehighlighter1_443_478_Open_Image" onclick="this.style.display='none'; Codehighlighter1_443_478_Open_Text.style.display='none'; Codehighlighter1_443_478_Closed_Image.style.display='inline'; Codehighlighter1_443_478_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_443_478_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_443_478_Closed_Text.style.display='none'; Codehighlighter1_443_478_Open_Image.style.display='inline'; Codehighlighter1_443_478_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_443_478_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_443_478_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> result[j];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                k</span>
										<span style="COLOR: #000000">=</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/InBlock.gif" align="top" />
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        visite[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" />        </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"> n; </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"> ( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> graph[k][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"> result[j]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> std::min( result[k], graph[k][j] ) )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                result[j]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> std::min ( result[k], graph[k][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/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_689_1054_Open_Image" onclick="this.style.display='none'; Codehighlighter1_689_1054_Open_Text.style.display='none'; Codehighlighter1_689_1054_Closed_Image.style.display='inline'; Codehighlighter1_689_1054_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_689_1054_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_689_1054_Closed_Text.style.display='none'; Codehighlighter1_689_1054_Open_Image.style.display='inline'; Codehighlighter1_689_1054_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_689_1054_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_689_1054_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">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"> test; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">t )<br /><img id="Codehighlighter1_757_1040_Open_Image" onclick="this.style.display='none'; Codehighlighter1_757_1040_Open_Text.style.display='none'; Codehighlighter1_757_1040_Closed_Image.style.display='inline'; Codehighlighter1_757_1040_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_757_1040_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_757_1040_Closed_Text.style.display='none'; Codehighlighter1_757_1040_Open_Image.style.display='inline'; Codehighlighter1_757_1040_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_757_1040_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_757_1040_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">n,</span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">m);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        memset( graph, </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">sizeof</span>
								<span style="COLOR: #000000">(graph) );<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 id="Codehighlighter1_852_939_Open_Image" onclick="this.style.display='none'; Codehighlighter1_852_939_Open_Text.style.display='none'; Codehighlighter1_852_939_Closed_Image.style.display='inline'; Codehighlighter1_852_939_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_852_939_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_852_939_Closed_Text.style.display='none'; Codehighlighter1_852_939_Open_Image.style.display='inline'; Codehighlighter1_852_939_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_852_939_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_852_939_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"> x, y,d;<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</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">,</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">x,</span>
										<span style="COLOR: #000000">&amp;</span>
										<span style="COLOR: #000000">y,</span>
										<span style="COLOR: #000000">&amp;</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" />            graph[x][y]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> d;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            graph[y][x]</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> d;<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" />        shortpath();<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        printf(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Scenario #%d:\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, t );<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[n] );<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" />
						<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>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63160.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-02 17:39 <a href="http://www.cppblog.com/Darren/archive/2008/10/02/63160.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>pku  2253   Frogger</title><link>http://www.cppblog.com/Darren/archive/2008/10/02/63152.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Thu, 02 Oct 2008 07:24:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/02/63152.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63152.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/02/63152.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63152.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63152.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">cmath</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">struct</span>
				<span style="COLOR: #000000"> Point<br /><img id="Codehighlighter1_69_81_Open_Image" onclick="this.style.display='none'; Codehighlighter1_69_81_Open_Text.style.display='none'; Codehighlighter1_69_81_Closed_Image.style.display='inline'; Codehighlighter1_69_81_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_69_81_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_69_81_Closed_Text.style.display='none'; Codehighlighter1_69_81_Open_Image.style.display='inline'; Codehighlighter1_69_81_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_69_81_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_69_81_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"> x,y;<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">double</span>
				<span style="COLOR: #000000"> graph[</span>
				<span style="COLOR: #000000">201</span>
				<span style="COLOR: #000000">][</span>
				<span style="COLOR: #000000">201</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />Point   data[</span>
				<span style="COLOR: #000000">201</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 src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">bool</span>
				<span style="COLOR: #000000">    visite[</span>
				<span style="COLOR: #000000">201</span>
				<span style="COLOR: #000000">];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">double</span>
				<span style="COLOR: #000000">  result[</span>
				<span style="COLOR: #000000">201</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"> Distance( Point</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> a, Point</span>
				<span style="COLOR: #000000">&amp;</span>
				<span style="COLOR: #000000"> b )<br /><img id="Codehighlighter1_220_301_Open_Image" onclick="this.style.display='none'; Codehighlighter1_220_301_Open_Text.style.display='none'; Codehighlighter1_220_301_Closed_Image.style.display='inline'; Codehighlighter1_220_301_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_220_301_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_220_301_Closed_Text.style.display='none'; Codehighlighter1_220_301_Open_Image.style.display='inline'; Codehighlighter1_220_301_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_220_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_220_301_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( (</span>
						<span style="COLOR: #0000ff">double</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.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 ) ) );<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">void</span>
				<span style="COLOR: #000000"> shortpath( </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000"> t )<br /><img id="Codehighlighter1_328_865_Open_Image" onclick="this.style.display='none'; Codehighlighter1_328_865_Open_Text.style.display='none'; Codehighlighter1_328_865_Closed_Image.style.display='inline'; Codehighlighter1_328_865_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_328_865_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_328_865_Closed_Text.style.display='none'; Codehighlighter1_328_865_Open_Image.style.display='inline'; Codehighlighter1_328_865_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_328_865_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_328_865_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 )<br /><img id="Codehighlighter1_361_402_Open_Image" onclick="this.style.display='none'; Codehighlighter1_361_402_Open_Text.style.display='none'; Codehighlighter1_361_402_Closed_Image.style.display='inline'; Codehighlighter1_361_402_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_361_402_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_361_402_Closed_Text.style.display='none'; Codehighlighter1_361_402_Open_Image.style.display='inline'; Codehighlighter1_361_402_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_361_402_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_402_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        visite[i]</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" />        result[i]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0.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"> 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 )<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"> graph[t][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" />    visite[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" />    </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"> </span>
						<span style="COLOR: #000000">1</span>
						<span style="COLOR: #000000">; </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">i )<br /><img id="Codehighlighter1_514_863_Open_Image" onclick="this.style.display='none'; Codehighlighter1_514_863_Open_Text.style.display='none'; Codehighlighter1_514_863_Closed_Image.style.display='inline'; Codehighlighter1_514_863_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_514_863_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_514_863_Closed_Text.style.display='none'; Codehighlighter1_514_863_Open_Image.style.display='inline'; Codehighlighter1_514_863_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_514_863_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_514_863_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"> std::numeric_limits</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #0000ff">double</span>
								<span style="COLOR: #000000">&gt;</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">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" />        </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"> n; </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"> ( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> result[j]</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> min )<br /><img id="Codehighlighter1_653_688_Open_Image" onclick="this.style.display='none'; Codehighlighter1_653_688_Open_Text.style.display='none'; Codehighlighter1_653_688_Closed_Image.style.display='inline'; Codehighlighter1_653_688_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_653_688_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_653_688_Closed_Text.style.display='none'; Codehighlighter1_653_688_Open_Image.style.display='inline'; Codehighlighter1_653_688_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
								<span id="Codehighlighter1_653_688_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_653_688_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"> result[j];<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                k</span>
										<span style="COLOR: #000000">=</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/InBlock.gif" align="top" />
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        visite[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" />        </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"> n; </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"> ( </span>
								<span style="COLOR: #000000">!</span>
								<span style="COLOR: #000000">visite[j] </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> std::max( graph[k][j], result[k] )</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> result[j] )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                result[j]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> std::max( graph[k][j], result[k] );<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 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_879_1250_Open_Image" onclick="this.style.display='none'; Codehighlighter1_879_1250_Open_Text.style.display='none'; Codehighlighter1_879_1250_Closed_Image.style.display='inline'; Codehighlighter1_879_1250_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_879_1250_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_879_1250_Closed_Text.style.display='none'; Codehighlighter1_879_1250_Open_Image.style.display='inline'; Codehighlighter1_879_1250_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_879_1250_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_879_1250_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"> num</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">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), n</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_927_1236_Open_Image" onclick="this.style.display='none'; Codehighlighter1_927_1236_Open_Text.style.display='none'; Codehighlighter1_927_1236_Closed_Image.style.display='inline'; Codehighlighter1_927_1236_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_927_1236_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_927_1236_Closed_Text.style.display='none'; Codehighlighter1_927_1236_Open_Image.style.display='inline'; Codehighlighter1_927_1236_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_927_1236_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_927_1236_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 )<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">data[i].x, </span>
								<span style="COLOR: #000000">&amp;</span>
								<span style="COLOR: #000000">data[i].y );<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"> 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">1</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 src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                graph[i][j]</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> Distance( data[i], data[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" />        shortpath(</span>
								<span style="COLOR: #000000">1</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">Scenario #%d\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, num</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">Frog Distance = %.3lf\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, result[</span>
								<span style="COLOR: #000000">2</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>
		</div>
<img src ="http://www.cppblog.com/Darren/aggbug/63152.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-02 15:24 <a href="http://www.cppblog.com/Darren/archive/2008/10/02/63152.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PKU 1018   Communication System</title><link>http://www.cppblog.com/Darren/archive/2008/10/01/63140.html</link><dc:creator>Darren</dc:creator><author>Darren</author><pubDate>Wed, 01 Oct 2008 14:06:00 GMT</pubDate><guid>http://www.cppblog.com/Darren/archive/2008/10/01/63140.html</guid><wfw:comment>http://www.cppblog.com/Darren/comments/63140.html</wfw:comment><comments>http://www.cppblog.com/Darren/archive/2008/10/01/63140.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/Darren/comments/commentRss/63140.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Darren/services/trackbacks/63140.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">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: #0000ff">set</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">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_88_182_Open_Image" onclick="this.style.display='none'; Codehighlighter1_88_182_Open_Text.style.display='none'; Codehighlighter1_88_182_Closed_Image.style.display='inline'; Codehighlighter1_88_182_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_88_182_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_88_182_Closed_Text.style.display='none'; Codehighlighter1_88_182_Open_Image.style.display='inline'; Codehighlighter1_88_182_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_88_182_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_88_182_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"> broad, price;<br /><img id="Codehighlighter1_122_123_Open_Image" onclick="this.style.display='none'; Codehighlighter1_122_123_Open_Text.style.display='none'; Codehighlighter1_122_123_Closed_Image.style.display='inline'; Codehighlighter1_122_123_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_122_123_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_122_123_Closed_Text.style.display='none'; Codehighlighter1_122_123_Open_Image.style.display='inline'; Codehighlighter1_122_123_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    Node()</span>
						<span id="Codehighlighter1_122_123_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_122_123_Open_Text">
								<span style="COLOR: #000000">{}</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    Node(</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">a,</span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">b)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        :broad(a),price(b)<br /><img id="Codehighlighter1_179_180_Open_Image" onclick="this.style.display='none'; Codehighlighter1_179_180_Open_Text.style.display='none'; Codehighlighter1_179_180_Closed_Image.style.display='inline'; Codehighlighter1_179_180_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_179_180_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_179_180_Closed_Text.style.display='none'; Codehighlighter1_179_180_Open_Image.style.display='inline'; Codehighlighter1_179_180_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_179_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">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_179_180_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" />Node 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">  length[</span>
				<span style="COLOR: #000000">100</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_238_1661_Open_Image" onclick="this.style.display='none'; Codehighlighter1_238_1661_Open_Text.style.display='none'; Codehighlighter1_238_1661_Closed_Image.style.display='inline'; Codehighlighter1_238_1661_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_238_1661_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_238_1661_Closed_Text.style.display='none'; Codehighlighter1_238_1661_Open_Image.style.display='inline'; Codehighlighter1_238_1661_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_238_1661_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_238_1661_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_302_1644_Open_Image" onclick="this.style.display='none'; Codehighlighter1_302_1644_Open_Text.style.display='none'; Codehighlighter1_302_1644_Closed_Image.style.display='inline'; Codehighlighter1_302_1644_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_302_1644_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_302_1644_Closed_Text.style.display='none'; Codehighlighter1_302_1644_Open_Image.style.display='inline'; Codehighlighter1_302_1644_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_302_1644_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_302_1644_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" />        </span>
								<span style="COLOR: #0000ff">set</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> br;<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">%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 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_410_725_Open_Image" onclick="this.style.display='none'; Codehighlighter1_410_725_Open_Text.style.display='none'; Codehighlighter1_410_725_Closed_Image.style.display='inline'; Codehighlighter1_410_725_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_410_725_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_410_725_Closed_Text.style.display='none'; Codehighlighter1_410_725_Open_Image.style.display='inline'; Codehighlighter1_410_725_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_410_725_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_410_725_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"> d,x,y;<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">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" />            length[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" />            </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"> d; </span>
										<span style="COLOR: #000000">++</span>
										<span style="COLOR: #000000">j )<br /><img id="Codehighlighter1_542_715_Open_Image" onclick="this.style.display='none'; Codehighlighter1_542_715_Open_Text.style.display='none'; Codehighlighter1_542_715_Closed_Image.style.display='inline'; Codehighlighter1_542_715_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_542_715_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_542_715_Closed_Text.style.display='none'; Codehighlighter1_542_715_Open_Image.style.display='inline'; Codehighlighter1_542_715_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_542_715_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_542_715_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">x,</span>
												<span style="COLOR: #000000">&amp;</span>
												<span style="COLOR: #000000">y);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                data[i][j]</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> Node(x,y);<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" />                br.insert(x);    </span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000">   Save all broad , use set to avoid repeating</span>
												<span style="COLOR: #008000">
														<br />
														<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />
												</span>
												<span style="COLOR: #000000">            }</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">set</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">::iterator pos;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">double</span>
								<span style="COLOR: #000000"> max</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> numeric_limits</span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #0000ff">double</span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000">::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"> ( pos</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> br.begin (); pos</span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> br.end (); </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">pos )   </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000">   for every broad</span>
								<span style="COLOR: #008000">
										<br />
										<img id="Codehighlighter1_899_1603_Open_Image" onclick="this.style.display='none'; Codehighlighter1_899_1603_Open_Text.style.display='none'; Codehighlighter1_899_1603_Closed_Image.style.display='inline'; Codehighlighter1_899_1603_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_899_1603_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_899_1603_Closed_Text.style.display='none'; Codehighlighter1_899_1603_Open_Image.style.display='inline'; Codehighlighter1_899_1603_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        </span>
								<span id="Codehighlighter1_899_1603_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_899_1603_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"> </span>
										<span style="COLOR: #000000">*</span>
										<span style="COLOR: #000000">pos;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #0000ff">int</span>
										<span style="COLOR: #000000">   total</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">bool</span>
										<span style="COLOR: #000000">  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" /><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 )   </span>
										<span style="COLOR: #008000">//</span>
										<span style="COLOR: #008000">  n devices</span>
										<span style="COLOR: #008000">
												<br />
												<img id="Codehighlighter1_1056_1464_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1056_1464_Open_Text.style.display='none'; Codehighlighter1_1056_1464_Closed_Image.style.display='inline'; Codehighlighter1_1056_1464_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_1056_1464_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1056_1464_Closed_Text.style.display='none'; Codehighlighter1_1056_1464_Open_Image.style.display='inline'; Codehighlighter1_1056_1464_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
										</span>
										<span style="COLOR: #000000">            </span>
										<span id="Codehighlighter1_1056_1464_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_1056_1464_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"> INT_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">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"> length[i]; </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"> ( data[i][j].broad</span>
												<span style="COLOR: #000000">&gt;=</span>
												<span style="COLOR: #000000"> t </span>
												<span style="COLOR: #000000">&amp;&amp;</span>
												<span style="COLOR: #000000"> data[i][j].price</span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> M )<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                        M</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> data[i][j].price;      </span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000">   find  the min price</span>
												<span style="COLOR: #008000">
														<br />
														<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
												</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"> ( M</span>
												<span style="COLOR: #000000">==</span>
												<span style="COLOR: #000000"> INT_MAX )<br /><img id="Codehighlighter1_1341_1418_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1341_1418_Open_Text.style.display='none'; Codehighlighter1_1341_1418_Closed_Image.style.display='inline'; Codehighlighter1_1341_1418_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1341_1418_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1341_1418_Closed_Text.style.display='none'; Codehighlighter1_1341_1418_Open_Image.style.display='inline'; Codehighlighter1_1341_1418_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span id="Codehighlighter1_1341_1418_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_1341_1418_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">true</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/InBlock.gif" align="top" />                total</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/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 ) </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 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: #0000ff">double</span>
										<span style="COLOR: #000000">)t</span>
										<span style="COLOR: #000000">/</span>
										<span style="COLOR: #000000"> (</span>
										<span style="COLOR: #0000ff">double</span>
										<span style="COLOR: #000000">)total</span>
										<span style="COLOR: #000000">&gt;</span>
										<span style="COLOR: #000000"> max ) max</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> (</span>
										<span style="COLOR: #0000ff">double</span>
										<span style="COLOR: #000000">)t</span>
										<span style="COLOR: #000000">/</span>
										<span style="COLOR: #000000"> (</span>
										<span style="COLOR: #0000ff">double</span>
										<span style="COLOR: #000000">)total;   </span>
										<span style="COLOR: #008000">//</span>
										<span style="COLOR: #008000">  update</span>
										<span style="COLOR: #008000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />
										</span>
										<span style="COLOR: #000000">        }</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">%.3lf\n</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">, max );<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>
<img src ="http://www.cppblog.com/Darren/aggbug/63140.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-01 22:06 <a href="http://www.cppblog.com/Darren/archive/2008/10/01/63140.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>