﻿<?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++博客-pzz-文章分类-ACM 搜索</title><link>http://www.cppblog.com/panzhizhou/category/18914.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 24 Mar 2012 13:18:53 GMT</lastBuildDate><pubDate>Sat, 24 Mar 2012 13:18:53 GMT</pubDate><ttl>60</ttl><item><title>九宫格 dfs</title><link>http://www.cppblog.com/panzhizhou/articles/168807.html</link><dc:creator>pzz</dc:creator><author>pzz</author><pubDate>Sat, 24 Mar 2012 09:41:00 GMT</pubDate><guid>http://www.cppblog.com/panzhizhou/articles/168807.html</guid><wfw:comment>http://www.cppblog.com/panzhizhou/comments/168807.html</wfw:comment><comments>http://www.cppblog.com/panzhizhou/articles/168807.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/panzhizhou/comments/commentRss/168807.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/panzhizhou/services/trackbacks/168807.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;&nbsp;1</span><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #000000">#include</span><span style="color: #000000">&lt;</span><span style="color: #000000">iostream</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #000000">cstdlib</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;&nbsp;3</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">string</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">using</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">namespace</span><span style="color: #000000">&nbsp;std;<br /></span><span style="color: #008080">&nbsp;&nbsp;5</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;map[</span><span style="color: #000000">10</span><span style="color: #000000">][</span><span style="color: #000000">10</span><span style="color: #000000">];<br /></span><span style="color: #008080">&nbsp;&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;row[</span><span style="color: #000000">10</span><span style="color: #000000">][</span><span style="color: #000000">10</span><span style="color: #000000">];<br /></span><span style="color: #008080">&nbsp;&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;col[</span><span style="color: #000000">10</span><span style="color: #000000">][</span><span style="color: #000000">10</span><span style="color: #000000">];<br /></span><span style="color: #008080">&nbsp;&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;grid[</span><span style="color: #000000">10</span><span style="color: #000000">][</span><span style="color: #000000">10</span><span style="color: #000000">];<br /></span><span style="color: #008080">&nbsp;&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;input()<br /></span><span style="color: #008080">&nbsp;10</span><span style="color: #000000"><img id="Codehighlighter1_157_519_Open_Image" onclick="this.style.display='none'; Codehighlighter1_157_519_Open_Text.style.display='none'; Codehighlighter1_157_519_Closed_Image.style.display='inline'; Codehighlighter1_157_519_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_157_519_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_157_519_Closed_Text.style.display='none'; Codehighlighter1_157_519_Open_Image.style.display='inline'; Codehighlighter1_157_519_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_157_519_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_157_519_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;11</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;char&nbsp;a[10];</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;12</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;a;<br /></span><span style="color: #008080">&nbsp;13</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;i</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000">&lt;</span><span style="color: #000000">9</span><span style="color: #000000">;i</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;14</span><span style="color: #000000"><img id="Codehighlighter1_212_517_Open_Image" onclick="this.style.display='none'; Codehighlighter1_212_517_Open_Text.style.display='none'; Codehighlighter1_212_517_Closed_Image.style.display='inline'; Codehighlighter1_212_517_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_212_517_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_212_517_Closed_Text.style.display='none'; Codehighlighter1_212_517_Open_Image.style.display='inline'; Codehighlighter1_212_517_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_212_517_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_212_517_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;15</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">getline(cin,a);</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;16</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;cin</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">a;<br /></span><span style="color: #008080">&nbsp;17</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;j</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">9</span><span style="color: #000000">;j</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;18</span><span style="color: #000000"><img id="Codehighlighter1_277_513_Open_Image" onclick="this.style.display='none'; Codehighlighter1_277_513_Open_Text.style.display='none'; Codehighlighter1_277_513_Closed_Image.style.display='inline'; Codehighlighter1_277_513_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_277_513_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_277_513_Closed_Text.style.display='none'; Codehighlighter1_277_513_Open_Image.style.display='inline'; Codehighlighter1_277_513_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_277_513_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_277_513_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;19</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map[i][j]</span><span style="color: #000000">=</span><span style="color: #000000">a[j]</span><span style="color: #000000">-</span><span style="color: #000000">'</span><span style="color: #000000">0</span><span style="color: #000000">'</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;20</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(map[i][j])<br /></span><span style="color: #008080">&nbsp;21</span><span style="color: #000000"><img id="Codehighlighter1_331_507_Open_Image" onclick="this.style.display='none'; Codehighlighter1_331_507_Open_Text.style.display='none'; Codehighlighter1_331_507_Closed_Image.style.display='inline'; Codehighlighter1_331_507_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_331_507_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_331_507_Closed_Text.style.display='none'; Codehighlighter1_331_507_Open_Image.style.display='inline'; Codehighlighter1_331_507_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_331_507_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_331_507_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;22</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;k</span><span style="color: #000000">=</span><span style="color: #000000">3</span><span style="color: #000000">*</span><span style="color: #000000">(i</span><span style="color: #000000">/</span><span style="color: #000000">3</span><span style="color: #000000">)</span><span style="color: #000000">+</span><span style="color: #000000">j</span><span style="color: #000000">/</span><span style="color: #000000">3</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;23</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[i][map[i][j]]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">indicates&nbsp;this&nbsp;row&nbsp;has&nbsp;the&nbsp;number&nbsp;map[i][j]</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;24</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col[j][map[i][j]]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//<br /></span><span style="color: #008080">&nbsp;25</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grid[k][map[i][j]]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;26</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;27</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;28</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;29</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;30</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;dfs(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;i,</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;j)<br /></span><span style="color: #008080">&nbsp;31</span><span style="color: #000000"><img id="Codehighlighter1_542_1534_Open_Image" onclick="this.style.display='none'; Codehighlighter1_542_1534_Open_Text.style.display='none'; Codehighlighter1_542_1534_Closed_Image.style.display='inline'; Codehighlighter1_542_1534_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_542_1534_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_542_1534_Closed_Text.style.display='none'; Codehighlighter1_542_1534_Open_Image.style.display='inline'; Codehighlighter1_542_1534_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_542_1534_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_542_1534_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;32</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;flag</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;33</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(i</span><span style="color: #000000">==</span><span style="color: #000000">9</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;34</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;35</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(map[i][j])<br /></span><span style="color: #008080">&nbsp;36</span><span style="color: #000000"><img id="Codehighlighter1_610_775_Open_Image" onclick="this.style.display='none'; Codehighlighter1_610_775_Open_Text.style.display='none'; Codehighlighter1_610_775_Closed_Image.style.display='inline'; Codehighlighter1_610_775_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_610_775_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_610_775_Closed_Text.style.display='none'; Codehighlighter1_610_775_Open_Image.style.display='inline'; Codehighlighter1_610_775_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_610_775_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_610_775_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;37</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(j</span><span style="color: #000000">==</span><span style="color: #000000">8</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;38</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag</span><span style="color: #000000">=</span><span style="color: #000000">dfs(i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">0</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;39</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;40</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag</span><span style="color: #000000">=</span><span style="color: #000000">dfs(i,j</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;41</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(flag)<br /></span><span style="color: #008080">&nbsp;42</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;43</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;44</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">这里不要改变map的值，起得是一个传递的作用&nbsp;</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;45</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #008000">//</span><span style="color: #008000">在这里如果当前要保存当前递归的信息，如果结果不满足，那么就要回朔，所以设置flag保存此次递归的结果是否可行</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;46</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;47</span><span style="color: #000000"><img id="Codehighlighter1_846_1519_Open_Image" onclick="this.style.display='none'; Codehighlighter1_846_1519_Open_Text.style.display='none'; Codehighlighter1_846_1519_Closed_Image.style.display='inline'; Codehighlighter1_846_1519_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_846_1519_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_846_1519_Closed_Text.style.display='none'; Codehighlighter1_846_1519_Open_Image.style.display='inline'; Codehighlighter1_846_1519_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_846_1519_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_846_1519_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;48</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;k</span><span style="color: #000000">=</span><span style="color: #000000">3</span><span style="color: #000000">*</span><span style="color: #000000">(i</span><span style="color: #000000">/</span><span style="color: #000000">3</span><span style="color: #000000">)</span><span style="color: #000000">+</span><span style="color: #000000">j</span><span style="color: #000000">/</span><span style="color: #000000">3</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;49</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;m</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;m</span><span style="color: #000000">&lt;=</span><span style="color: #000000">9</span><span style="color: #000000">;m</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;50</span><span style="color: #000000"><img id="Codehighlighter1_908_1508_Open_Image" onclick="this.style.display='none'; Codehighlighter1_908_1508_Open_Text.style.display='none'; Codehighlighter1_908_1508_Closed_Image.style.display='inline'; Codehighlighter1_908_1508_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_908_1508_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_908_1508_Closed_Text.style.display='none'; Codehighlighter1_908_1508_Open_Image.style.display='inline'; Codehighlighter1_908_1508_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_908_1508_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_908_1508_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;51</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;52</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #000000">!</span><span style="color: #000000">row[i][m]</span><span style="color: #000000">&amp;&amp;!</span><span style="color: #000000">col[j][m]</span><span style="color: #000000">&amp;&amp;!</span><span style="color: #000000">grid[k][m])<br /></span><span style="color: #008080">&nbsp;53</span><span style="color: #000000"><img id="Codehighlighter1_978_1496_Open_Image" onclick="this.style.display='none'; Codehighlighter1_978_1496_Open_Text.style.display='none'; Codehighlighter1_978_1496_Closed_Image.style.display='inline'; Codehighlighter1_978_1496_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_978_1496_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_978_1496_Closed_Text.style.display='none'; Codehighlighter1_978_1496_Open_Image.style.display='inline'; Codehighlighter1_978_1496_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_978_1496_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_978_1496_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;54</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map[i][j]</span><span style="color: #000000">=</span><span style="color: #000000">m;<br /></span><span style="color: #008080">&nbsp;55</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[i][m]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;56</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col[j][m]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;57</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grid[k][m]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;58</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(j</span><span style="color: #000000">==</span><span style="color: #000000">8</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;59</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag</span><span style="color: #000000">=</span><span style="color: #000000">dfs(i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">,</span><span style="color: #000000">0</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;60</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;61</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag</span><span style="color: #000000">=</span><span style="color: #000000">dfs(i,j</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">);&nbsp;<br /></span><span style="color: #008080">&nbsp;62</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">如果将}放在这里结束if的话，那么就是错误的答案，因为回朔要紧接着上一次递归进去的位置，这个位置很重要，否则就是错误的答案&nbsp;<br /></span><span style="color: #008080">&nbsp;63</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">在这里如果当前要保存当前递归的信息，如果结果不满足，那么就要回朔，所以设置flag保存此次递归的结果是否可行&nbsp;</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;64</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(flag)<br /></span><span style="color: #008080">&nbsp;65</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;66</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">进行回朔&nbsp;</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;67</span><span style="color: #008000"><img id="Codehighlighter1_1383_1487_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1383_1487_Open_Text.style.display='none'; Codehighlighter1_1383_1487_Closed_Image.style.display='inline'; Codehighlighter1_1383_1487_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1383_1487_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1383_1487_Closed_Text.style.display='none'; Codehighlighter1_1383_1487_Open_Image.style.display='inline'; Codehighlighter1_1383_1487_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif"></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1383_1487_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1383_1487_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;68</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map[i][j]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;69</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[i][m]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;70</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col[j][m]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;71</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grid[k][m]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;&nbsp;<br /></span><span style="color: #008080">&nbsp;72</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;73</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #008000">//</span><span style="color: #008000">if</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;74</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #008000">//</span><span style="color: #008000">for</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;75</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;76</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;&nbsp;<br /></span><span style="color: #008080">&nbsp;77</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;78</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;output()<br /></span><span style="color: #008080">&nbsp;79</span><span style="color: #000000"><img id="Codehighlighter1_1550_1654_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1550_1654_Open_Text.style.display='none'; Codehighlighter1_1550_1654_Closed_Image.style.display='inline'; Codehighlighter1_1550_1654_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_1550_1654_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1550_1654_Closed_Text.style.display='none'; Codehighlighter1_1550_1654_Open_Image.style.display='inline'; Codehighlighter1_1550_1654_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1550_1654_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1550_1654_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;80</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;i</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;i</span><span style="color: #000000">&lt;</span><span style="color: #000000">9</span><span style="color: #000000">;i</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;81</span><span style="color: #000000"><img id="Codehighlighter1_1577_1652_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1577_1652_Open_Text.style.display='none'; Codehighlighter1_1577_1652_Closed_Image.style.display='inline'; Codehighlighter1_1577_1652_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1577_1652_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1577_1652_Closed_Text.style.display='none'; Codehighlighter1_1577_1652_Open_Image.style.display='inline'; Codehighlighter1_1577_1652_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1577_1652_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1577_1652_Open_Text"><span style="color: #000000">{&nbsp;</span><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;j</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">9</span><span style="color: #000000">;j</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;82</span><span style="color: #000000"><img id="Codehighlighter1_1604_1633_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1604_1633_Open_Text.style.display='none'; Codehighlighter1_1604_1633_Closed_Image.style.display='inline'; Codehighlighter1_1604_1633_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1604_1633_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1604_1633_Closed_Text.style.display='none'; Codehighlighter1_1604_1633_Open_Image.style.display='inline'; Codehighlighter1_1604_1633_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1604_1633_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1604_1633_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;83</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">map[i][j];<br /></span><span style="color: #008080">&nbsp;84</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;85</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;cout</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">endl;<br /></span><span style="color: #008080">&nbsp;86</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;87</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;88</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;main()<br /></span><span style="color: #008080">&nbsp;89</span><span style="color: #000000"><img id="Codehighlighter1_1667_1876_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1667_1876_Open_Text.style.display='none'; Codehighlighter1_1667_1876_Closed_Image.style.display='inline'; Codehighlighter1_1667_1876_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_1667_1876_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1667_1876_Closed_Text.style.display='none'; Codehighlighter1_1667_1876_Open_Image.style.display='inline'; Codehighlighter1_1667_1876_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1667_1876_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1667_1876_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;90</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;T;<br /></span><span style="color: #008080">&nbsp;91</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;cin</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">T;<br /></span><span style="color: #008080">&nbsp;92</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">while</span><span style="color: #000000">(T</span><span style="color: #000000">--</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;93</span><span style="color: #000000"><img id="Codehighlighter1_1711_1853_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1711_1853_Open_Text.style.display='none'; Codehighlighter1_1711_1853_Closed_Image.style.display='inline'; Codehighlighter1_1711_1853_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1711_1853_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1711_1853_Closed_Text.style.display='none'; Codehighlighter1_1711_1853_Open_Image.style.display='inline'; Codehighlighter1_1711_1853_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_1711_1853_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1711_1853_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">&nbsp;94</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;memset(row,</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(row));<br /></span><span style="color: #008080">&nbsp;95</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;memset(grid,</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(grid));<br /></span><span style="color: #008080">&nbsp;96</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;memset(col,</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(col));<br /></span><span style="color: #008080">&nbsp;97</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;input();<br /></span><span style="color: #008080">&nbsp;98</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;dfs(</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #000000">0</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;99</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;output();<br /></span><span style="color: #008080">100</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">101</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;system(</span><span style="color: #000000">"</span><span style="color: #000000">pause</span><span style="color: #000000">"</span><span style="color: #000000">);<br /></span><span style="color: #008080">102</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000">&nbsp;<br /></span><span style="color: #008080">103</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span></div><img src ="http://www.cppblog.com/panzhizhou/aggbug/168807.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/panzhizhou/" target="_blank">pzz</a> 2012-03-24 17:41 <a href="http://www.cppblog.com/panzhizhou/articles/168807.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>