<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>梁剑的Blog &#187; 算法</title>
	<atom:link href="http://icomes.net/tag/%e7%ae%97%e6%b3%95/feed/" rel="self" type="application/rss+xml" />
	<link>http://icomes.net</link>
	<description>做有趣的事，做有用的人</description>
	<lastBuildDate>Sat, 05 Nov 2011 18:23:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>字符串大小写全排列</title>
		<link>http://icomes.net/2009/04/25/%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%a4%a7%e5%b0%8f%e5%86%99%e5%85%a8%e6%8e%92%e5%88%97/</link>
		<comments>http://icomes.net/2009/04/25/%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%a4%a7%e5%b0%8f%e5%86%99%e5%85%a8%e6%8e%92%e5%88%97/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 16:55:33 +0000</pubDate>
		<dc:creator>梁剑</dc:creator>
				<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[算法]]></category>

		<guid isPermaLink="false">http://icomes.net/?p=378</guid>
		<description><![CDATA[闲来没事，睡觉前写了这个程序。 #include &#60;cctype&#62; #include &#60;string&#62; #include &#60;iostream&#62; &#160; using namespace std; &#160; void ToOtherCase&#40;char &#38;c&#41; &#123; if&#40; isupper&#40;c&#41; &#41; c = tolower&#40;c&#41;; else c = toupper&#40;c&#41;; &#125; &#160; void AllCase&#40;string &#38;sInput, int iIndex&#41; &#123; if&#40; iIndex == sInput.size&#40;&#41; &#41; &#123; cout &#60;&#60; sInput &#60;&#60; endl; return; &#125; &#160; AllCase&#40;sInput, iIndex + 1&#41;; &#160; if&#40; !isalpha&#40;sInput&#91;iIndex&#93;&#41; [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="黄子华 – 娱乐圈血肉史2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2011%2F01%2F22%2F%25E9%25BB%2584%25E5%25AD%2590%25E5%258D%258E-%25E5%25A8%25B1%25E4%25B9%2590%25E5%259C%2588%25E8%25A1%2580%25E8%2582%2589%25E5%258F%25B22%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014211.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">黄子华 – 娱乐圈血肉史2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Another Hello World is running on my iPhone!" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F08%2F30%2Fanother-hello-world-is-running-on-my-iphone%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015234.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Another Hello World is running on my iPhone!</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="利用ssh tunnel建立本地sock代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F07%2F25%2F%25E5%2588%25A9%25E7%2594%25A8ssh-tunnel%25E5%25BB%25BA%25E7%25AB%258B%25E6%259C%25AC%25E5%259C%25B0sock%25E4%25BB%25A3%25E7%2590%2586%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015597.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">利用ssh tunnel建立本地sock代理</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用visio画的UML图例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F10%2F18%2F%25E7%2594%25A8visio%25E7%2594%25BB%25E7%259A%2584uml%25E5%259B%25BE%25E4%25BE%258B%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015128.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用visio画的UML图例</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>闲来没事，睡觉前写了这个程序。</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;cctype&gt;</span>
<span style="color: #339900;">#include &lt;string&gt;</span>
<span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> ToOtherCase<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span> <span style="color: #000040;">&amp;</span>c<span style="color: #008000;">&#41;</span> 
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">isupper</span><span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
        c <span style="color: #000080;">=</span> <span style="color: #0000dd;">tolower</span><span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> 
    <span style="color: #0000ff;">else</span>
        c <span style="color: #000080;">=</span> <span style="color: #0000dd;">toupper</span><span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> AllCase<span style="color: #008000;">&#40;</span>string <span style="color: #000040;">&amp;</span>sInput, <span style="color: #0000ff;">int</span> iIndex<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> iIndex <span style="color: #000080;">==</span> sInput.<span style="color: #007788;">size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>   
    <span style="color: #008000;">&#123;</span>   
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> sInput <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>   
&nbsp;
    AllCase<span style="color: #008000;">&#40;</span>sInput, iIndex <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> 
&nbsp;
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> <span style="color: #000040;">!</span><span style="color: #0000dd;">isalpha</span><span style="color: #008000;">&#40;</span>sInput<span style="color: #008000;">&#91;</span>iIndex<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
    ToOtherCase<span style="color: #008000;">&#40;</span>sInput<span style="color: #008000;">&#91;</span>iIndex<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    AllCase<span style="color: #008000;">&#40;</span>sInput, iIndex <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> 
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> c, <span style="color: #0000ff;">char</span> <span style="color: #000040;">**</span>v<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> c <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span> 
    <span style="color: #008000;">&#123;</span>   
        <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Usage: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> v<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; word&quot;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>   
    string sInput <span style="color: #000080;">=</span> v<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
    AllCase<span style="color: #008000;">&#40;</span>sInput, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>ps， 为什么我的网站这么慢？</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="黄子华 – 娱乐圈血肉史2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2011%2F01%2F22%2F%25E9%25BB%2584%25E5%25AD%2590%25E5%258D%258E-%25E5%25A8%25B1%25E4%25B9%2590%25E5%259C%2588%25E8%25A1%2580%25E8%2582%2589%25E5%258F%25B22%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014211.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">黄子华 – 娱乐圈血肉史2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="阅读空间的GM脚本" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F01%2F17%2F%25E9%2598%2585%25E8%25AF%25BB%25E7%25A9%25BA%25E9%2597%25B4%25E7%259A%2584gs%25E8%2584%259A%25E6%259C%25AC%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015260.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">阅读空间的GM脚本</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用visio画的UML图例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F10%2F18%2F%25E7%2594%25A8visio%25E7%2594%25BB%25E7%259A%2584uml%25E5%259B%25BE%25E4%25BE%258B%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015128.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用visio画的UML图例</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="The Last Lecture" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2011%2F10%2F15%2Fthe-last-lecture%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F25%2F%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2%25E5%25A4%25A7%25E5%25B0%258F%25E5%2586%2599%25E5%2585%25A8%25E6%258E%2592%25E5%2588%2597%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/10/15/9228539.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">The Last Lecture</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://icomes.net/2009/04/25/%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%a4%a7%e5%b0%8f%e5%86%99%e5%85%a8%e6%8e%92%e5%88%97/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数独的递归解法</title>
		<link>http://icomes.net/2009/04/03/%e6%95%b0%e7%8b%ac%e7%9a%84%e9%80%92%e5%bd%92%e8%a7%a3%e6%b3%95/</link>
		<comments>http://icomes.net/2009/04/03/%e6%95%b0%e7%8b%ac%e7%9a%84%e9%80%92%e5%bd%92%e8%a7%a3%e6%b3%95/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 10:35:29 +0000</pubDate>
		<dc:creator>梁剑</dc:creator>
				<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[算法]]></category>

		<guid isPermaLink="false">http://icomes.net/?p=338</guid>
		<description><![CDATA[还是把伤脑筋的事情留给CPU吧 #include &#60;iostream&#62; #include &#60;cstdlib&#62; #include &#60;cstdio&#62; &#160; using namespace std; &#160; class CShuDu &#123; public: CShuDu&#40;&#41; &#123; _iLeft = 0; _GuestCount = 0; _Depth = 0; _CurrentX = _CurrentX = 0; &#125;; ~CShuDu&#40;&#41;&#123;&#125;; void GetInput&#40;&#41; &#123; for&#40; int i = 0; i &#60; 9; i++ &#41; &#123; for&#40; int j = 0; j &#60; [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="黄子华 – 娱乐圈血肉史2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2011%2F01%2F22%2F%25E9%25BB%2584%25E5%25AD%2590%25E5%258D%258E-%25E5%25A8%25B1%25E4%25B9%2590%25E5%259C%2588%25E8%25A1%2580%25E8%2582%2589%25E5%258F%25B22%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014211.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">黄子华 – 娱乐圈血肉史2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="阅读空间的GM脚本" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F01%2F17%2F%25E9%2598%2585%25E8%25AF%25BB%25E7%25A9%25BA%25E9%2597%25B4%25E7%259A%2584gs%25E8%2584%259A%25E6%259C%25AC%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015260.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">阅读空间的GM脚本</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="利用ssh tunnel建立本地sock代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F07%2F25%2F%25E5%2588%25A9%25E7%2594%25A8ssh-tunnel%25E5%25BB%25BA%25E7%25AB%258B%25E6%259C%25AC%25E5%259C%25B0sock%25E4%25BB%25A3%25E7%2590%2586%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015597.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">利用ssh tunnel建立本地sock代理</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="用visio画的UML图例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F10%2F18%2F%25E7%2594%25A8visio%25E7%2594%25BB%25E7%259A%2584uml%25E5%259B%25BE%25E4%25BE%258B%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015128.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">用visio画的UML图例</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>还是把伤脑筋的事情留给CPU吧</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #339900;">#include &lt;cstdlib&gt;</span>
<span style="color: #339900;">#include &lt;cstdio&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">class</span> CShuDu
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
		CShuDu<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			_iLeft <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			_GuestCount <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			_Depth <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			_CurrentX <span style="color: #000080;">=</span> _CurrentX <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
		~CShuDu<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">void</span> GetInput<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					<span style="color: #0000ff;">int</span> n<span style="color: #008080;">;</span>
					<span style="color: #0000dd;">cin</span> <span style="color: #000080;">&gt;&gt;</span> n<span style="color: #008080;">;</span>
					<span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>n<span style="color: #008000;">&#41;</span>
					<span style="color: #008000;">&#123;</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">2</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">4</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">5</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">6</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">7</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">8</span><span style="color: #008080;">:</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">:</span>
							_Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iType</span> 	<span style="color: #000080;">=</span> FIXED<span style="color: #008080;">;</span>
							_Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span>	<span style="color: #000080;">=</span> n<span style="color: #008080;">;</span>
							<span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
						<span style="color: #0000ff;">case</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">:</span>
							_Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iType</span> 	<span style="color: #000080;">=</span> BLANK<span style="color: #008080;">;</span>
							_Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span>	<span style="color: #000080;">=</span> n<span style="color: #008080;">;</span>
							_iLeft<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
							<span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
						<span style="color: #0000ff;">default</span><span style="color: #008080;">:</span>
							<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Input Error&quot;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>	
							<span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
					<span style="color: #008000;">&#125;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">void</span> OutputBoard<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> x, <span style="color: #0000ff;">int</span> y<span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> _GuestCount <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #000080;">&lt;&lt;</span> _Depth <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #000080;">&lt;&lt;</span> _iLeft <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;(&quot;</span> <span style="color: #000080;">&lt;&lt;</span> x <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;,&quot;</span> <span style="color: #000080;">&lt;&lt;</span> y <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;)&quot;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
			<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>  &quot;</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> i <span style="color: #000080;">==</span> y <span style="color: #008000;">&#41;</span>
					<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; &quot;</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;x  &quot;</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">else</span>
					<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; &quot;</span> <span style="color: #000080;">&lt;&lt;</span> i <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;  &quot;</span><span style="color: #008080;">;</span>
&nbsp;
			<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> i <span style="color: #000080;">==</span> x <span style="color: #008000;">&#41;</span>
					<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;x &quot;</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">else</span>
					<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #000080;">&lt;&lt;</span> i <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; &quot;</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> _Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iType</span> <span style="color: #000080;">==</span> FIXED <span style="color: #008000;">&#41;</span>
						<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot; &quot;</span> <span style="color: #000080;">&lt;&lt;</span> _Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;  &quot;</span><span style="color: #008080;">;</span>
					<span style="color: #0000ff;">else</span>
						<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;(&quot;</span> <span style="color: #000080;">&lt;&lt;</span> _Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;) &quot;</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
				<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">void</span> Guest<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> x, <span style="color: #0000ff;">int</span> y<span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			_Depth<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
			_CurrentX <span style="color: #000080;">=</span> x<span style="color: #008080;">;</span>
			_CurrentY <span style="color: #000080;">=</span> y<span style="color: #008080;">;</span>
			_GuestCount<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
&nbsp;
			<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> _iLeft <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span>	
			<span style="color: #008000;">&#123;</span>
				OutputBoard<span style="color: #008000;">&#40;</span><span style="color: #000040;">-</span><span style="color: #0000dd;">1</span>, <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;=</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				_Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span> <span style="color: #000080;">=</span> i<span style="color: #008080;">;</span>	
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> IsBoardValid<span style="color: #008000;">&#40;</span>x, y<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					<span style="color: #0000ff;">int</span> _x <span style="color: #000080;">=</span> x<span style="color: #008080;">;</span>
					<span style="color: #0000ff;">int</span> _y <span style="color: #000080;">=</span> y<span style="color: #008080;">;</span>
					GetNextPosition<span style="color: #008000;">&#40;</span>_x, _y<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
					_iLeft<span style="color: #000040;">--</span><span style="color: #008080;">;</span>
					Guest<span style="color: #008000;">&#40;</span>_x, _y<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
					_iLeft<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
			_Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iValue</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>	
			_Depth<span style="color: #000040;">--</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">void</span> Run<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">int</span> x, y<span style="color: #008080;">;</span>
			x <span style="color: #000080;">=</span> y <span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
			GetNextPosition<span style="color: #008000;">&#40;</span>x, y<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			Guest<span style="color: #008000;">&#40;</span>x, y<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
		<span style="color: #0000ff;">int</span> _iLeft<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">int</span> _GuestCount<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">int</span> _Depth<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">int</span> _CurrentX<span style="color: #008080;">;</span>
		<span style="color: #0000ff;">int</span> _CurrentY<span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #0000ff;">enum</span> NodeType<span style="color: #008000;">&#123;</span> FIXED, BLANK <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
		<span style="color: #0000ff;">struct</span> Node<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">int</span> iValue<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">int</span> iType<span style="color: #008080;">;</span>
			<span style="color: #0000ff;">bool</span> operator<span style="color: #000080;">==</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> Node <span style="color: #000040;">&amp;</span>r<span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">return</span> iValue <span style="color: #000080;">==</span> r.<span style="color: #007788;">iValue</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
		Node _Board<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">9</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">9</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #0000ff;">bool</span> IsBoardValid<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> x, <span style="color: #0000ff;">int</span> y<span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">int</span> X <span style="color: #000080;">=</span> x <span style="color: #000040;">/</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">int</span> Y <span style="color: #000080;">=</span> y <span style="color: #000040;">/</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> i <span style="color: #000080;">==</span> x <span style="color: #008000;">&#41;</span>
					<span style="color: #0000ff;">continue</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> _Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> _Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span>
					<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">9</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> i <span style="color: #000080;">==</span> y <span style="color: #008000;">&#41;</span>
					<span style="color: #0000ff;">continue</span><span style="color: #008080;">;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> _Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> _Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span>
					<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> i <span style="color: #000080;">=</span> X <span style="color: #000040;">*</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #008000;">&#40;</span>X<span style="color: #000040;">+</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">*</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> i<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">unsigned</span> j <span style="color: #000080;">=</span> Y <span style="color: #000040;">*</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> j <span style="color: #000080;">&lt;</span> <span style="color: #008000;">&#40;</span>Y<span style="color: #000040;">+</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">*</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> i <span style="color: #000080;">==</span> x <span style="color: #000040;">&amp;&amp;</span> j <span style="color: #000080;">==</span> y <span style="color: #008000;">&#41;</span>
						<span style="color: #0000ff;">continue</span><span style="color: #008080;">;</span>
					<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> _Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> _Board<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#41;</span>
						<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #666666;">//	OutputBoard(x, y);</span>
			<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">void</span> GetNextPosition<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> <span style="color: #000040;">&amp;</span>x, <span style="color: #0000ff;">int</span> <span style="color: #000040;">&amp;</span>y<span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> x <span style="color: #000080;">==</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span>
				x <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> y <span style="color: #000080;">==</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span>
				y <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
			<span style="color: #0000ff;">else</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> y <span style="color: #000080;">==</span> <span style="color: #0000dd;">8</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					x<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
					y <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
				<span style="color: #0000ff;">else</span>
				<span style="color: #008000;">&#123;</span>
					y<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
			<span style="color: #008000;">&#125;</span>
&nbsp;
			<span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span> _Board<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">iType</span> <span style="color: #000080;">==</span> FIXED <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> y <span style="color: #000080;">==</span> <span style="color: #0000dd;">8</span> <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#123;</span>
					x<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
					y <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
				<span style="color: #0000ff;">else</span>
				<span style="color: #008000;">&#123;</span>
					y<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
				<span style="color: #008000;">&#125;</span>
				CheckPosition<span style="color: #008000;">&#40;</span>x, y<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0000ff;">void</span> CheckPosition<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> x, <span style="color: #0000ff;">int</span> y<span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> x <span style="color: #000080;">&gt;=</span> <span style="color: #0000dd;">9</span> <span style="color: #000040;">||</span> y <span style="color: #000080;">&gt;=</span> <span style="color: #0000dd;">9</span> <span style="color: #008000;">&#41;</span>
			<span style="color: #008000;">&#123;</span>
				<span style="color: #0000dd;">cerr</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Position Error&quot;</span> <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
				<span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">-</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
			<span style="color: #008000;">&#125;</span>
		<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	CShuDu cShudu<span style="color: #008080;">;</span>
	cShudu.<span style="color: #007788;">GetInput</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	cShudu.<span style="color: #007788;">Run</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<pre>
0 0 7 2 8 0 3 0 0
2 3 0 0 0 7 1 0 0
0 4 0 0 0 6 7 2 0
9 0 0 0 7 0 0 1 0
4 0 1 0 0 5 6 0 8
0 7 0 8 2 0 0 0 4
0 8 6 4 0 0 0 5 0
0 0 2 9 0 0 0 6 7
0 0 4 0 6 2 8 0 0
</pre>
<pre>
161	46	0(-1,-1)
		   0   1   2   3   4   5   6   7   8
		0 (1) (6)  7   2   8  (9)  3  (4) (5)
		1  2   3  (9) (5) (4)  7   1  (8) (6)
		2 (8)  4  (5) (1) (3)  6   7   2  (9)
		3  9  (5) (8) (6)  7  (4) (2)  1  (3)
		4  4  (2)  1  (3) (9)  5   6  (7)  8
		5 (6)  7  (3)  8   2  (1) (5) (9)  4
		6 (7)  8   6   4  (1) (3) (9)  5  (2)
		7 (3) (1)  2   9  (5) (8) (4)  6   7
		8 (5) (9)  4  (7)  6   2   8  (3) (1)
</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="利用ssh tunnel建立本地sock代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F07%2F25%2F%25E5%2588%25A9%25E7%2594%25A8ssh-tunnel%25E5%25BB%25BA%25E7%25AB%258B%25E6%259C%25AC%25E5%259C%25B0sock%25E4%25BB%25A3%25E7%2590%2586%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015597.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">利用ssh tunnel建立本地sock代理</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Ubuntu 8.04 Server在VMWare中无法启动的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2008%2F06%2F29%2Fubuntu-804-server%25E5%259C%25A8vmware%25E4%25B8%25AD%25E6%2597%25A0%25E6%25B3%2595%25E5%2590%25AF%25E5%258A%25A8%25E7%259A%2584%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15017346.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Ubuntu 8.04 Server在VMWare中无法启动的解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="浏览器战争" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F01%2F13%2F%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8%25E6%2588%2598%25E4%25BA%2589%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015466.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">浏览器战争</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="新主题iBlog2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F15%2F%25E6%2596%25B0%25E4%25B8%25BB%25E9%25A2%2598iblog2%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F04%2F03%2F%25E6%2595%25B0%25E7%258B%25AC%25E7%259A%2584%25E9%2580%2592%25E5%25BD%2592%25E8%25A7%25A3%25E6%25B3%2595%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014886.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">新主题iBlog2</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://icomes.net/2009/04/03/%e6%95%b0%e7%8b%ac%e7%9a%84%e9%80%92%e5%bd%92%e8%a7%a3%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

