﻿<?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++博客-LSM ACM/ICPC算法程序设计空间-随笔分类-STL</title><link>http://www.cppblog.com/shiming413/category/4953.html</link><description>alpc02 at poj</description><language>zh-cn</language><lastBuildDate>Tue, 20 May 2008 18:35:16 GMT</lastBuildDate><pubDate>Tue, 20 May 2008 18:35:16 GMT</pubDate><ttl>60</ttl><item><title>学习STL的几个函数</title><link>http://www.cppblog.com/shiming413/archive/2007/08/18/30304.html</link><dc:creator>LSM</dc:creator><author>LSM</author><pubDate>Sat, 18 Aug 2007 05:03:00 GMT</pubDate><guid>http://www.cppblog.com/shiming413/archive/2007/08/18/30304.html</guid><wfw:comment>http://www.cppblog.com/shiming413/comments/30304.html</wfw:comment><comments>http://www.cppblog.com/shiming413/archive/2007/08/18/30304.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/shiming413/comments/commentRss/30304.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/shiming413/services/trackbacks/30304.html</trackback:ping><description><![CDATA[<a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=3349">http://acm.pku.edu.cn/JudgeOnline/problem?id=3349</a><br><font color="#0000ff" size="5">Snowflake Snow Snowflakes</font><br>原来用hash过的，后来发现mill竟然排序就过了，更惊奇的是用了一堆STL的东东。<br><br>mill一直是&#8220;自食其力&#8221;型选手，记得以前连STL里面的sort都懒得用，说自己写快排快些，习惯了。这次再看他代码，吓一跳，完全变了风格，里面动不动就是STL的东西，copy()，rotate()，reverse()，一堆，还有从没见过的lexicographical_compare()，算是长见识了，于是照着写了个，把代码留下，以后还用得着。<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: #eeeeee;"><span style="color: #008080;">&nbsp;1</span><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"><span style="color: #008000;">//</span><span style="color: #008000;">3349</span><span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;2</span><span style="color: #008000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">algorithm</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">namespace</span><span style="color: #000000;">&nbsp;std;<br></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"><br></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;N&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">100010</span><span style="color: #000000;">;<br></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"><br></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;a[N][</span><span style="color: #000000;">6</span><span style="color: #000000;">];<br></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;sign[N];<br></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"><br></span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="Codehighlighter1_137_197_Open_Image" onclick="this.style.display='none'; codehighlighter1_137_197_open_text.style.display="'none';" codehighlighter1_137_197_closed_image.style.display="'inline';" codehighlighter1_137_197_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_137_197_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_137_197_closed_text.style.display="'none';" codehighlighter1_137_197_open_image.style.display="'inline';" codehighlighter1_137_197_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span style="color: #0000ff;">bool</span><span style="color: #000000;">&nbsp;cmp(</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">x,&nbsp;</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">y)&nbsp;</span><span id="Codehighlighter1_137_197_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_137_197_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;lexicographical_compare(a[x],a[x]</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,a[y],a[y]</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">);<br></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top">}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="Codehighlighter1_210_895_Open_Image" onclick="this.style.display='none'; codehighlighter1_210_895_open_text.style.display="'none';" codehighlighter1_210_895_closed_image.style.display="'inline';" codehighlighter1_210_895_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_210_895_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_210_895_closed_text.style.display="'none';" codehighlighter1_210_895_open_image.style.display="'inline';" codehighlighter1_210_895_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;main()&nbsp;</span><span id="Codehighlighter1_210_895_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_210_895_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;freopen(</span><span style="color: #000000;">"</span><span style="color: #000000;">in.txt</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">r</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;stdin);<br></span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;n,&nbsp;i,&nbsp;j;<br></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;b[</span><span style="color: #000000;">6</span><span style="color: #000000;">];<br></span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">n);<br></span><span style="color: #008080;">18</span><span style="color: #000000;"><img id="Codehighlighter1_307_670_Open_Image" onclick="this.style.display='none'; codehighlighter1_307_670_open_text.style.display="'none';" codehighlighter1_307_670_closed_image.style.display="'inline';" codehighlighter1_307_670_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_307_670_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_307_670_closed_text.style.display="'none';" codehighlighter1_307_670_open_image.style.display="'inline';" codehighlighter1_307_670_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_307_670_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_307_670_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">19</span><span style="color: #000000;"><img id="Codehighlighter1_330_355_Open_Image" onclick="this.style.display='none'; codehighlighter1_330_355_open_text.style.display="'none';" codehighlighter1_330_355_closed_image.style.display="'inline';" codehighlighter1_330_355_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_330_355_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_330_355_closed_text.style.display="'none';" codehighlighter1_330_355_open_image.style.display="'inline';" codehighlighter1_330_355_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(j</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">6</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_330_355_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_330_355_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">j);<br></span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;copy(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,&nbsp;a[i]);<br></span><span style="color: #008080;">23</span><span style="color: #000000;"><img id="Codehighlighter1_400_505_Open_Image" onclick="this.style.display='none'; codehighlighter1_400_505_open_text.style.display="'none';" codehighlighter1_400_505_closed_image.style.display="'inline';" codehighlighter1_400_505_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_400_505_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_400_505_closed_text.style.display="'none';" codehighlighter1_400_505_open_image.style.display="'inline';" codehighlighter1_400_505_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(j</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">5</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_400_505_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_400_505_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rotate(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">);<br></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(lexicographical_compare(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,&nbsp;a[i],&nbsp;a[i]</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">))<br></span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;copy(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,&nbsp;a[i]);<br></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">);<br></span><span style="color: #008080;">29</span><span style="color: #000000;"><img id="Codehighlighter1_547_652_Open_Image" onclick="this.style.display='none'; codehighlighter1_547_652_open_text.style.display="'none';" codehighlighter1_547_652_closed_image.style.display="'inline';" codehighlighter1_547_652_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_547_652_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_547_652_closed_text.style.display="'none';" codehighlighter1_547_652_open_image.style.display="'inline';" codehighlighter1_547_652_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(j</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">6</span><span style="color: #000000;">;&nbsp;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_547_652_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_547_652_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rotate(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">);<br></span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(lexicographical_compare(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,&nbsp;a[i],&nbsp;a[i]</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">))<br></span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;copy(b,&nbsp;b</span><span style="color: #000000;">+</span><span style="color: #000000;">6</span><span style="color: #000000;">,&nbsp;a[i]);<br></span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sign[i]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;i;<br></span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;sort(sign,&nbsp;sign</span><span style="color: #000000;">+</span><span style="color: #000000;">n,&nbsp;cmp);<br></span><span style="color: #008080;">37</span><span style="color: #000000;"><img id="Codehighlighter1_718_838_Open_Image" onclick="this.style.display='none'; codehighlighter1_718_838_open_text.style.display="'none';" codehighlighter1_718_838_closed_image.style.display="'inline';" codehighlighter1_718_838_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_718_838_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_718_838_closed_text.style.display="'none';" codehighlighter1_718_838_open_image.style.display="'inline';" codehighlighter1_718_838_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">;&nbsp;i</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_718_838_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_718_838_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">38</span><span style="color: #000000;"><img id="Codehighlighter1_778_835_Open_Image" onclick="this.style.display='none'; codehighlighter1_778_835_open_text.style.display="'none';" codehighlighter1_778_835_closed_image.style.display="'inline';" codehighlighter1_778_835_closed_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_778_835_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_778_835_closed_text.style.display="'none';" codehighlighter1_778_835_open_image.style.display="'inline';" codehighlighter1_778_835_open_text.style.display="'inline';"" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(memcmp(a[sign[i</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">]],&nbsp;a[sign[i]],&nbsp;</span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(a[</span><span style="color: #000000;">0</span><span style="color: #000000;">]))&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">)&nbsp;</span><span id="Codehighlighter1_778_835_Closed_Text" style="border: 1px solid #808080; display: none; background-color: #ffffff;"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id="Codehighlighter1_778_835_Open_Text"><span style="color: #000000;">{<br></span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">Twin&nbsp;snowflakes&nbsp;found.\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&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;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">42</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">No&nbsp;two&nbsp;snowflakes&nbsp;are&nbsp;alike.\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align="top">&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;">;<br></span><span style="color: #008080;">45</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top">}</span></span><span style="color: #000000;"><br></span><span style="color: #008080;">46</span><span style="color: #000000;"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align="top"></span></div><img src ="http://www.cppblog.com/shiming413/aggbug/30304.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/shiming413/" target="_blank">LSM</a> 2007-08-18 13:03 <a href="http://www.cppblog.com/shiming413/archive/2007/08/18/30304.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>