﻿<?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-文章分类-字符串匹配</title><link>http://www.cppblog.com/panzhizhou/category/19233.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 19 May 2012 10:58:58 GMT</lastBuildDate><pubDate>Sat, 19 May 2012 10:58:58 GMT</pubDate><ttl>60</ttl><item><title>校赛之编译器</title><link>http://www.cppblog.com/panzhizhou/articles/173922.html</link><dc:creator>pzz</dc:creator><author>pzz</author><pubDate>Mon, 07 May 2012 10:36:00 GMT</pubDate><guid>http://www.cppblog.com/panzhizhou/articles/173922.html</guid><wfw:comment>http://www.cppblog.com/panzhizhou/comments/173922.html</wfw:comment><comments>http://www.cppblog.com/panzhizhou/articles/173922.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/panzhizhou/comments/commentRss/173922.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/panzhizhou/services/trackbacks/173922.html</trackback:ping><description><![CDATA[<div>&nbsp; 这一题可以说是字符串的模拟题，而在当时思路没有很清晰的情况下，就马上开始敲键盘了，只是认为这一题不难，应该很快就可以解出来的，但是在编码过程中遇到了不少问题，这些问题直接影响了思维，加之现场的压力，后来就越来越乱了，呼呼。。以后要注意一定要思路清晰，在纸上可以模拟下问题的解决思路，必须的透彻，这是很重要的！<br />&nbsp; 问题描述如下：<br />&nbsp;&nbsp;&nbsp; 一开始给定一些变量以及相对应的值，以%%%结尾，最后给出一些表达式的值，然我们求表达式的值是多少，形式如：<br />&nbsp;&nbsp;&nbsp; aa = 34<br />&nbsp;&nbsp;&nbsp; bb = 45<br />&nbsp;&nbsp;&nbsp; cc = 56<br />&nbsp;&nbsp;&nbsp; %%%<br />&nbsp;&nbsp;&nbsp; aa + bb * cc<br />&nbsp;&nbsp;&nbsp; aa + bb - cc<br />-------------------------------------------------------------------------------------------------------------------
<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;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;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">sstream</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 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;4</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">iterator</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;5</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">map</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;6</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">vector</span><span style="color: #000000">&gt;</span><span style="color: #000000"><br /></span><span style="color: #008080">&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">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;8</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;input;<br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />map</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">string</span><span style="color: #000000">,</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;my;<br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />map</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">char</span><span style="color: #000000">,</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;f;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />vector</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;num;<br /></span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />vector</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">&nbsp;op;<br /></span><span style="color: #008080">13</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;init()<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img id="Codehighlighter1_221_267_Open_Image" onclick="this.style.display='none'; Codehighlighter1_221_267_Open_Text.style.display='none'; Codehighlighter1_221_267_Closed_Image.style.display='inline'; Codehighlighter1_221_267_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_221_267_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_221_267_Closed_Text.style.display='none'; Codehighlighter1_221_267_Open_Image.style.display='inline'; Codehighlighter1_221_267_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_221_267_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_221_267_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;f[</span><span style="color: #000000">'</span><span style="color: #000000">+</span><span style="color: #000000">'</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;f[</span><span style="color: #000000">'</span><span style="color: #000000">-</span><span style="color: #000000">'</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">2</span><span style="color: #000000">;<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;f[</span><span style="color: #000000">'</span><span style="color: #000000">*</span><span style="color: #000000">'</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">3</span><span style="color: #000000">;<br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;f[</span><span style="color: #000000">'</span><span style="color: #000000">/</span><span style="color: #000000">'</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">4</span><span style="color: #000000">;<br /></span><span style="color: #008080">19</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">20</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;predeal(</span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;s)<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_294_388_Open_Image" onclick="this.style.display='none'; Codehighlighter1_294_388_Open_Text.style.display='none'; Codehighlighter1_294_388_Closed_Image.style.display='inline'; Codehighlighter1_294_388_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_294_388_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_294_388_Closed_Text.style.display='none'; Codehighlighter1_294_388_Open_Image.style.display='inline'; Codehighlighter1_294_388_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_294_388_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_294_388_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">22</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">int</span><span style="color: #000000">&nbsp;len</span><span style="color: #000000">=</span><span style="color: #000000">s.size();<br /></span><span style="color: #008080">23</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">len;i</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">24</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">(s[i]</span><span style="color: #000000">==</span><span style="color: #000000">'</span><span style="color: #000000">=</span><span style="color: #000000">'</span><span style="color: #000000">)<br /></span><span style="color: #008080">25</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[i]</span><span style="color: #000000">=</span><span style="color: #000000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">'</span><span style="color: #000000">;<br /></span><span style="color: #008080">26</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;s;<br /></span><span style="color: #008080">27</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">28</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;prevdeal2(</span><span style="color: #0000ff">string</span><span style="color: #000000">&nbsp;s)<br /></span><span style="color: #008080">29</span><span style="color: #000000"><img id="Codehighlighter1_418_562_Open_Image" onclick="this.style.display='none'; Codehighlighter1_418_562_Open_Text.style.display='none'; Codehighlighter1_418_562_Closed_Image.style.display='inline'; Codehighlighter1_418_562_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_418_562_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_418_562_Closed_Text.style.display='none'; Codehighlighter1_418_562_Open_Image.style.display='inline'; Codehighlighter1_418_562_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_418_562_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_418_562_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">30</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">int</span><span style="color: #000000">&nbsp;len</span><span style="color: #000000">=</span><span style="color: #000000">s.size();<br /></span><span style="color: #008080">31</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">len;i</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">32</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #000000">!</span><span style="color: #000000">isalnum(s[i])</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">s[i]</span><span style="color: #000000">!=</span><span style="color: #000000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">'</span><span style="color: #000000">)&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">如果不是字符且不是空格</span><span style="color: #008000"><br /></span><span style="color: #008080">33</span><span style="color: #008000"><img id="Codehighlighter1_517_547_Open_Image" onclick="this.style.display='none'; Codehighlighter1_517_547_Open_Text.style.display='none'; Codehighlighter1_517_547_Closed_Image.style.display='inline'; Codehighlighter1_517_547_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_517_547_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_517_547_Closed_Text.style.display='none'; Codehighlighter1_517_547_Open_Image.style.display='inline'; Codehighlighter1_517_547_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;</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_517_547_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_517_547_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">34</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[i]</span><span style="color: #000000">=</span><span style="color: #000000">f[s[i]]</span><span style="color: #000000">+</span><span style="color: #000000">'</span><span style="color: #000000">0</span><span style="color: #000000">'</span><span style="color: #000000">;<br /></span><span style="color: #008080">35</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">&nbsp;<br /></span><span style="color: #008080">36</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;s;<br /></span><span style="color: #008080">37</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">38</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">39</span><span style="color: #000000"><img id="Codehighlighter1_575_1675_Open_Image" onclick="this.style.display='none'; Codehighlighter1_575_1675_Open_Text.style.display='none'; Codehighlighter1_575_1675_Closed_Image.style.display='inline'; Codehighlighter1_575_1675_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_575_1675_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_575_1675_Closed_Text.style.display='none'; Codehighlighter1_575_1675_Open_Image.style.display='inline'; Codehighlighter1_575_1675_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_575_1675_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_575_1675_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">40</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">string</span><span style="color: #000000">&nbsp;s;<br /></span><span style="color: #008080">41</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">(getline(cin,s)</span><span style="color: #000000">&amp;&amp;</span><span style="color: #000000">s</span><span style="color: #000000">!=</span><span style="color: #000000">"</span><span style="color: #000000">%%%</span><span style="color: #000000">"</span><span style="color: #000000">)<br /></span><span style="color: #008080">42</span><span style="color: #000000"><img id="Codehighlighter1_631_818_Open_Image" onclick="this.style.display='none'; Codehighlighter1_631_818_Open_Text.style.display='none'; Codehighlighter1_631_818_Closed_Image.style.display='inline'; Codehighlighter1_631_818_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_631_818_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_631_818_Closed_Text.style.display='none'; Codehighlighter1_631_818_Open_Image.style.display='inline'; Codehighlighter1_631_818_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_631_818_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_631_818_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">43</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: #008000">//</span><span style="color: #008000">strlwr((char&nbsp;*)s.c_str());</span><span style="color: #008000"><br /></span><span style="color: #008080">44</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;input</span><span style="color: #000000">=</span><span style="color: #000000">predeal(s);<br /></span><span style="color: #008080">45</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;istringstream&nbsp;</span><span style="color: #0000ff">in</span><span style="color: #000000">(input);<br /></span><span style="color: #008080">46</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">string</span><span style="color: #000000">&nbsp;op1;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">操作数1&nbsp;</span><span style="color: #008000"><br /></span><span style="color: #008080">47</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;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;num1;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">数值</span><span style="color: #008000"><br /></span><span style="color: #008080">48</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;</span><span style="color: #0000ff">in</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">op1</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">num1;<br /></span><span style="color: #008080">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;my[op1]</span><span style="color: #000000">=</span><span style="color: #000000">num1;&nbsp;<br /></span><span style="color: #008080">50</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">51</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;map</span><span style="color: #000000">&lt;</span><span style="color: #0000ff">string</span><span style="color: #000000">,</span><span style="color: #0000ff">int</span><span style="color: #000000">&gt;</span><span style="color: #000000">::iterator&nbsp;it;<br /></span><span style="color: #008080">52</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;init();<br /></span><span style="color: #008080">53</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">while</span><span style="color: #000000">(getline(cin,s))<br /></span><span style="color: #008080">54</span><span style="color: #000000"><img id="Codehighlighter1_893_1652_Open_Image" onclick="this.style.display='none'; Codehighlighter1_893_1652_Open_Text.style.display='none'; Codehighlighter1_893_1652_Closed_Image.style.display='inline'; Codehighlighter1_893_1652_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_893_1652_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_893_1652_Closed_Text.style.display='none'; Codehighlighter1_893_1652_Open_Image.style.display='inline'; Codehighlighter1_893_1652_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&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_893_1652_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_893_1652_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">55</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num.clear();<br /></span><span style="color: #008080">56</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;op.clear();<br /></span><span style="color: #008080">57</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">string</span><span style="color: #000000">&nbsp;deal</span><span style="color: #000000">=</span><span style="color: #000000">prevdeal2(s);<br /></span><span style="color: #008080">58</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">string</span><span style="color: #000000">&nbsp;ans;<br /></span><span style="color: #008080">59</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">int</span><span style="color: #000000">&nbsp;len</span><span style="color: #000000">=</span><span style="color: #000000">s.size();<br /></span><span style="color: #008080">60</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;istringstream&nbsp;</span><span style="color: #0000ff">in</span><span style="color: #000000">(deal);<br /></span><span style="color: #008080">61</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">in</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">ans;<br /></span><span style="color: #008080">62</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num.push_back(my[ans]);&nbsp;&nbsp;<br /></span><span style="color: #008080">63</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: #008000">//</span><span style="color: #008000">接着再读入一个字符和字符串&nbsp;</span><span style="color: #008000"><br /></span><span style="color: #008080">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;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;op1;<br /></span><span style="color: #008080">65</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">string</span><span style="color: #000000">&nbsp;ans2;<br /></span><span style="color: #008080">66</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">while</span><span style="color: #000000">(</span><span style="color: #0000ff">in</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">op1</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">ans2)<br /></span><span style="color: #008080">67</span><span style="color: #000000"><img id="Codehighlighter1_1160_1419_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1160_1419_Open_Text.style.display='none'; Codehighlighter1_1160_1419_Closed_Image.style.display='inline'; Codehighlighter1_1160_1419_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1160_1419_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1160_1419_Closed_Text.style.display='none'; Codehighlighter1_1160_1419_Open_Image.style.display='inline'; Codehighlighter1_1160_1419_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&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_1160_1419_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1160_1419_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">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;</span><span style="color: #0000ff">if</span><span style="color: #000000">(op1</span><span style="color: #000000">==</span><span style="color: #000000">3</span><span style="color: #000000">)<br /></span><span style="color: #008080">69</span><span style="color: #000000"><img id="Codehighlighter1_1187_1227_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1187_1227_Open_Text.style.display='none'; Codehighlighter1_1187_1227_Closed_Image.style.display='inline'; Codehighlighter1_1187_1227_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1187_1227_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1187_1227_Closed_Text.style.display='none'; Codehighlighter1_1187_1227_Open_Image.style.display='inline'; Codehighlighter1_1187_1227_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_1187_1227_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1187_1227_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">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;num.back()</span><span style="color: #000000">*=</span><span style="color: #000000">my[ans2];<br /></span><span style="color: #008080">71</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: #000000"><br /></span><span style="color: #008080">72</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">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(op1</span><span style="color: #000000">==</span><span style="color: #000000">4</span><span style="color: #000000">)<br /></span><span style="color: #008080">73</span><span style="color: #000000"><img id="Codehighlighter1_1259_1299_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1259_1299_Open_Text.style.display='none'; Codehighlighter1_1259_1299_Closed_Image.style.display='inline'; Codehighlighter1_1259_1299_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1259_1299_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1259_1299_Closed_Text.style.display='none'; Codehighlighter1_1259_1299_Open_Image.style.display='inline'; Codehighlighter1_1259_1299_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_1259_1299_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1259_1299_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">74</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;num.back()</span><span style="color: #000000">*=</span><span style="color: #000000">my[ans2];<br /></span><span style="color: #008080">75</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: #000000">&nbsp;<br /></span><span style="color: #008080">76</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">else</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(op1</span><span style="color: #000000">==</span><span style="color: #000000">1</span><span style="color: #000000">||</span><span style="color: #000000">op1</span><span style="color: #000000">==</span><span style="color: #000000">2</span><span style="color: #000000">)<br /></span><span style="color: #008080">77</span><span style="color: #000000"><img id="Codehighlighter1_1340_1412_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1340_1412_Open_Text.style.display='none'; Codehighlighter1_1340_1412_Closed_Image.style.display='inline'; Codehighlighter1_1340_1412_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1340_1412_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1340_1412_Closed_Text.style.display='none'; Codehighlighter1_1340_1412_Open_Image.style.display='inline'; Codehighlighter1_1340_1412_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_1340_1412_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1340_1412_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">78</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;op.push_back(op1);<br /></span><span style="color: #008080">79</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;num.push_back(my[ans2]);&nbsp;<br /></span><span style="color: #008080">80</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: #000000"><br /></span><span style="color: #008080">81</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">82</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">int</span><span style="color: #000000">&nbsp;res</span><span style="color: #000000">=</span><span style="color: #000000">num[</span><span style="color: #000000">0</span><span style="color: #000000">];<br /></span><span style="color: #008080">83</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">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">op.size();i</span><span style="color: #000000">++</span><span style="color: #000000">)<br /></span><span style="color: #008080">84</span><span style="color: #000000"><img id="Codehighlighter1_1481_1608_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1481_1608_Open_Text.style.display='none'; Codehighlighter1_1481_1608_Closed_Image.style.display='inline'; Codehighlighter1_1481_1608_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1481_1608_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1481_1608_Closed_Text.style.display='none'; Codehighlighter1_1481_1608_Open_Image.style.display='inline'; Codehighlighter1_1481_1608_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif">&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_1481_1608_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1481_1608_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">85</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">(op[i]</span><span style="color: #000000">==</span><span style="color: #000000">1</span><span style="color: #000000">)<br /></span><span style="color: #008080">86</span><span style="color: #000000"><img id="Codehighlighter1_1508_1539_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1508_1539_Open_Text.style.display='none'; Codehighlighter1_1508_1539_Closed_Image.style.display='inline'; Codehighlighter1_1508_1539_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1508_1539_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1508_1539_Closed_Text.style.display='none'; Codehighlighter1_1508_1539_Open_Image.style.display='inline'; Codehighlighter1_1508_1539_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_1508_1539_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1508_1539_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">87</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;res</span><span style="color: #000000">+=</span><span style="color: #000000">num[i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">];&nbsp;<br /></span><span style="color: #008080">88</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">89</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">&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">(op[i]</span><span style="color: #000000">==</span><span style="color: #000000">2</span><span style="color: #000000">)<br /></span><span style="color: #008080">90</span><span style="color: #000000"><img id="Codehighlighter1_1571_1601_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1571_1601_Open_Text.style.display='none'; Codehighlighter1_1571_1601_Closed_Image.style.display='inline'; Codehighlighter1_1571_1601_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_1571_1601_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1571_1601_Closed_Text.style.display='none'; Codehighlighter1_1571_1601_Open_Image.style.display='inline'; Codehighlighter1_1571_1601_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_1571_1601_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1571_1601_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">91</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;res</span><span style="color: #000000">-=</span><span style="color: #000000">num[i</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">];<br /></span><span style="color: #008080">92</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">93</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">94</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">"</span><span style="color: #000000">the&nbsp;ans&nbsp;is:&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">res</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">endl;&nbsp;<br /></span><span style="color: #008080">95</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">96</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">97</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">98</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span></div><br /></div><img src ="http://www.cppblog.com/panzhizhou/aggbug/173922.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-05-07 18:36 <a href="http://www.cppblog.com/panzhizhou/articles/173922.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AC自动机</title><link>http://www.cppblog.com/panzhizhou/articles/173242.html</link><dc:creator>pzz</dc:creator><author>pzz</author><pubDate>Mon, 30 Apr 2012 07:04:00 GMT</pubDate><guid>http://www.cppblog.com/panzhizhou/articles/173242.html</guid><wfw:comment>http://www.cppblog.com/panzhizhou/comments/173242.html</wfw:comment><comments>http://www.cppblog.com/panzhizhou/articles/173242.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/panzhizhou/comments/commentRss/173242.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/panzhizhou/services/trackbacks/173242.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: ac自动机Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&nbsp;&nbsp;1#include&lt;iostream&gt;&nbsp;&nbsp;2#include&lt;cstdio&gt;&nbsp;&nbsp;3#include&lt;...&nbsp;&nbsp;<a href='http://www.cppblog.com/panzhizhou/articles/173242.html'>阅读全文</a><img src ="http://www.cppblog.com/panzhizhou/aggbug/173242.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-04-30 15:04 <a href="http://www.cppblog.com/panzhizhou/articles/173242.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>