﻿<?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++博客-ACM___________________________-随笔分类-ACM ( 模拟 )</title><link>http://www.cppblog.com/MiYu/category/14416.html</link><description>                             ______________白白の屋</description><language>zh-cn</language><lastBuildDate>Thu, 28 Oct 2010 22:28:13 GMT</lastBuildDate><pubDate>Thu, 28 Oct 2010 22:28:13 GMT</pubDate><ttl>60</ttl><item><title>HDU 3082 HDOJ 3082 Simplify The Circuit ACM 3082 IN HDU</title><link>http://www.cppblog.com/MiYu/archive/2010/10/28/131671.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Thu, 28 Oct 2010 14:23:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/10/28/131671.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/131671.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/10/28/131671.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/131671.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/131671.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; "><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;</p><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; line-height: normal; font-size: 13px; "><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">MiYu原创, 转帖请注明 : 转载自&nbsp;<a href="http://baiyun.me/"><font  color="#000000">______________白白の屋</font></a>&nbsp;&nbsp;<img src="http://www.cnblogs.com/Emoticons/baimantou/223332482.gif" alt="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">题目地址 :</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3082">http://acm.hdu.edu.cn/showproblem.php?pid=3082</a></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">题目分析:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;&nbsp; &nbsp; 没什么特殊的方法, 简单模拟就可以了 &nbsp;:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;代码 :</p><div class="cnblogs_code" style="background-color: rgb(245, 245, 245); font-family: 'Courier New'; font-size: 13px; border-left-color: rgb(204, 204, 204); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; word-break: break-all; overflow-x: auto; overflow-y: auto; "><img src="http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif" class="code_img_opened" id="code_img_opened_77214648-0457-4248-8994-41a3150567f1" style="vertical-align: middle; padding-right: 5px; "><span class="cnblogs_code_collapse" style="border-right-color: rgb(128, 128, 128); border-right-width: 1px; border-right-style: solid; border-top-color: rgb(128, 128, 128); border-top-width: 1px; border-top-style: solid; border-left-color: rgb(128, 128, 128); border-left-width: 1px; border-left-style: solid; border-bottom-color: rgb(128, 128, 128); border-bottom-width: 1px; border-bottom-style: solid; background-color: rgb(255, 255, 255); padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; font-family: 'Courier New'; ">代码</span><div id="cnblogs_code_open_77214648-0457-4248-8994-41a3150567f1"><div><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">/*</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); "><br>Mail&nbsp;to&nbsp;&nbsp;&nbsp;:&nbsp;miyubai@gamil.com<br>My&nbsp;Blog&nbsp;&nbsp;&nbsp;:&nbsp;www.baiyun.me<br>Link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); text-decoration: underline; ">http://www.cnblogs.com/MiYu</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">&nbsp;&nbsp;||&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); text-decoration: underline; ">http://www.cppblog.com/MiYu</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); "><br>Author&nbsp;By&nbsp;:&nbsp;MiYu<br>Test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;1<br>Complier&nbsp;&nbsp;:&nbsp;g++&nbsp;mingw32-3.4.2<br>Program&nbsp;&nbsp;&nbsp;:&nbsp;HDU_3082<br>Doc&nbsp;Name&nbsp;&nbsp;:&nbsp;Simplify&nbsp;The&nbsp;Circuit<br></span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">*/</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br></span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">//</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">#pragma&nbsp;warning(&nbsp;disable:4789&nbsp;)</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); "><br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">iostream</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">fstream</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">sstream</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">algorithm</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">string</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">set</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">map</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">utility</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">queue</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">stack</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">list</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">vector</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstdio</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstdlib</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstring</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cmath</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">ctime</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">using</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">namespace</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;std;<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">char</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;str[</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">110</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">];<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">char</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">*</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">tok;<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;T;<br>&nbsp;&nbsp;&nbsp;&nbsp;scanf&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">%d</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&amp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">T&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">while</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;T&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">--</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;N;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">double</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;res&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">%d</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&amp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">N&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;N;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">%s</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;str&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tok&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;strtok&nbsp;(&nbsp;str,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">-</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;t&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;atoi&nbsp;(&nbsp;tok&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;r&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;t;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">while</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;tok&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;strtok&nbsp;(&nbsp;NULL,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">-</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;)&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;atoi&nbsp;(&nbsp;tok&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;t;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1.0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">/</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;r;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">%.2lf\n</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1.0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">/</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;res&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">return</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>}<br></span></div></div></div><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;</p></span></span>
<img src ="http://www.cppblog.com/MiYu/aggbug/131671.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-10-28 22:23 <a href="http://www.cppblog.com/MiYu/archive/2010/10/28/131671.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDU 1230 HDOJ 1230 火星A+B ACM 1230 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/10/28/131654.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Thu, 28 Oct 2010 11:46:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/10/28/131654.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/131654.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/10/28/131654.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/131654.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/131654.html</trackback:ping><description><![CDATA[<meta http-equiv="content-type" content="text/html; charset=utf-8"><span  style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; "><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">MiYu原创, 转帖请注明 : 转载自&nbsp;<a href="http://baiyun.me/"><font  color="#000000">______________白白の屋</font></a>&nbsp;&nbsp;<img src="http://www.cnblogs.com/Emoticons/baimantou/223332482.gif" alt="">&nbsp;&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;题目地址:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1230">http://acm.hdu.edu.cn/showproblem.php?pid=1230</a></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">题目描述:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;&nbsp; &nbsp; &nbsp;纯粹的模拟题........</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">代码:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; ">&nbsp;<span  style="font-family: 'Courier New'; font-size: 13px; "><img src="http://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif" class="code_img_opened" id="code_img_opened_f0ef5983-f52e-4136-98b4-9bd871aafe3a" style="vertical-align: middle; padding-right: 5px; "><span class="cnblogs_code_collapse" style="border-right-color: rgb(128, 128, 128); border-right-width: 1px; border-right-style: solid; border-top-color: rgb(128, 128, 128); border-top-width: 1px; border-top-style: solid; border-left-color: rgb(128, 128, 128); border-left-width: 1px; border-left-style: solid; border-bottom-color: rgb(128, 128, 128); border-bottom-width: 1px; border-bottom-style: solid; background-color: rgb(255, 255, 255); padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; ">代码</span></span></p><div class="cnblogs_code" style="background-color: rgb(245, 245, 245); font-family: 'Courier New'; font-size: 13px; border-left-color: rgb(204, 204, 204); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; word-break: break-all; overflow-x: auto; overflow-y: auto; "><div id="cnblogs_code_open_f0ef5983-f52e-4136-98b4-9bd871aafe3a"><div><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">iostream</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">string</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">algorithm</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstdlib</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstdio</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br>#include&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">cstring</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); "><br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">using</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">namespace</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;std;<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">string</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;a,&nbsp;b;<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;prim[</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">40</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;{</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">2</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">3</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">5</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">7</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">11</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">13</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">17</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">19</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">23</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">29</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">31</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">37</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">41</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">43</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">47</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">53</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">59</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">61</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">67</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">71</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">73</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">79</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">83</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">89</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">97</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">101</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">103</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">107</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">109</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">113</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">};<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;x[</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">30</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">],&nbsp;y[</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">30</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">];<br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;main&nbsp;()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">while</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;cin&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;a&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;b,&nbsp;a&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">!=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">0</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&amp;&amp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;b&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">!=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">0</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset&nbsp;(&nbsp;x,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">sizeof</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">(x)&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset&nbsp;(&nbsp;y,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">sizeof</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">(y)&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;j&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;k&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;a.size();&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">if</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;a[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">!=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x[j]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;x[j]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">*</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">10</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;a[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">-</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">0</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">else</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;j;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;b.size();&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">if</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;b[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">!=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">,</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y[k]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;y[k]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">*</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">10</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;b[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">-</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">0</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">'</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">else</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;k;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse&nbsp;(&nbsp;x</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;x&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;j&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse&nbsp;(&nbsp;y</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,&nbsp;y&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;k&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;f&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;m&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;j;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;mm&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;k;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;t&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">if</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;m&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;mm&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;swap&nbsp;(&nbsp;m,&nbsp;mm&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">//</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); ">cout&nbsp;&lt;&lt;&nbsp;m&nbsp;&lt;&lt;&nbsp;"&nbsp;"&nbsp;&lt;&lt;&nbsp;mm&nbsp;&lt;&lt;&nbsp;endl;</span><span style="font-family: 'Courier New'; color: rgb(0, 128, 0); "><br></span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;z[</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">30</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;m;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;x[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;y[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;f;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">/</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;prim[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">%=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;prim[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[m</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;m&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">1</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&lt;=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;mm;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;temp&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">if</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">!</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">t&nbsp;)&nbsp;temp&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;y[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">else</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;temp&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;x[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;temp&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">+</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;f;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">/</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;prim[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[i]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">%=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;prim[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">if</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;f&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z[</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">++</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">mm]&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;f;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">for</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">int</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">=</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;mm;&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&gt;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">--</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;i&nbsp;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf&nbsp;(&nbsp;i&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">==</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;mm&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">?</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">%d</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;:&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">,%d</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 0); ">"</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">,z[i]&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;putchar&nbsp;(&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">10</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 255); ">return</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">&nbsp;</span><span style="font-family: 'Courier New'; color: rgb(128, 0, 128); ">0</span><span style="font-family: 'Courier New'; color: rgb(0, 0, 0); ">;<br>}</span></div></div></div></span>
<img src ="http://www.cppblog.com/MiYu/aggbug/131654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-10-28 19:46 <a href="http://www.cppblog.com/MiYu/archive/2010/10/28/131654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ 2526 HDU 2526 浪漫手机 ACM 2526 IN HDU</title><link>http://www.cppblog.com/MiYu/archive/2010/09/26/127770.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sun, 26 Sep 2010 08:42:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/09/26/127770.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/127770.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/09/26/127770.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/127770.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/127770.html</trackback:ping><description><![CDATA[<p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; ">MiYu原创, 转帖请注明 : 转载自&nbsp;<a href="http://www.cnblogs.com/MiYu"><font  color="#000000">______________白白の屋</font></a>&nbsp;&nbsp;<img src="http://www.cnblogs.com/Emoticons/baimantou/223332482.gif" alt="">&nbsp;&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; ">&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; ">题目地址:</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; "><span class="Apple-tab-span" style="white-space: pre; ">	</span><a href="http://acm.hdu.edu.cn/showproblem.php?pid=2526">http://acm.hdu.edu.cn/showproblem.php?pid=2526</a></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; ">题目描述:</p><div class="cnblogs_code" style="background-color: rgb(245, 245, 245); font-family: 'Courier New'; font-size: 13px; border-left-color: rgb(204, 204, 204); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; word-break: break-all; overflow-x: auto; overflow-y: auto; line-height: 21px; "><div><font  color="#800080"><h1 style="color: rgb(26, 92, 200); text-align: center; font-family: 'Times New Roman'; line-height: normal; font-size: medium; ">浪漫手机</h1><font style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><strong><span style="font-family: Arial; font-size: 12px; font-weight: bold; color: green; ">Time Limit: 3000/1000 MS (Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory Limit: 32768/32768 K (Java/Others)<br>Total Submission(s): 362&nbsp;&nbsp;&nbsp;&nbsp;Accepted Submission(s): 150<br></span></strong></font><br><br><div class="panel_title" align="left" style="height: 38px; background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding-top: 0px; padding-right: 14px; padding-bottom: 0px; padding-left: 14px; color: rgb(124, 169, 237); font-size: 18px; font-family: Arial; font-weight: bold; line-height: normal; background-position: 0% 100%; background-repeat: no-repeat no-repeat; ">Problem Description</div><div class="panel_content" style="height: auto; background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 20px; padding-bottom: 0px; padding-left: 20px; font-size: 14px; font-family: 'Times New Roman'; text-align: left; color: rgb(0, 0, 0); line-height: normal; background-repeat: no-repeat repeat; ">最近，WisKey迷上了手机铃声，但是他对音律不是很懂，所以他想着能否用计算机来随机生成铃声。当WisKey写好程序后，发现生成出来的根本不是铃声，而是噪声！<br>之后WisKey查阅了一些乐谱发现，其实很多铃声是以某种规律变化的，这里为了简化这个难题，他以连续3个音符来判断下个音符。<br>如有模式<br><img src="http://acm.hdu.edu.cn/data/images/c153-1007-1.JPG" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br>在给定第一行乐谱的情况下，按模式将产生如下乐谱图形：<br><img src="http://acm.hdu.edu.cn/data/images/c153-1007-2.JPG" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; "><br>我们用0表示白色格子，用1表示黑色格子。<br>对于没有连续3个格子的边缘（即没有左边格子或右边格子），我们直接用白色格子代替缺少的那一个格子。<br></div><div class="panel_bottom" style="height: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><br><div class="panel_title" align="left" style="height: 38px; background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding-top: 0px; padding-right: 14px; padding-bottom: 0px; padding-left: 14px; color: rgb(124, 169, 237); font-size: 18px; font-family: Arial; font-weight: bold; line-height: normal; background-position: 0% 100%; background-repeat: no-repeat no-repeat; ">Input</div><div class="panel_content" style="height: auto; background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 20px; padding-bottom: 0px; padding-left: 20px; font-size: 14px; font-family: 'Times New Roman'; text-align: left; color: rgb(0, 0, 0); line-height: normal; background-repeat: no-repeat repeat; ">第一行有一个整数T，代表有T组数据。<br>每组数据有一个整数M，表示要输出M行乐谱。接着有8行模式串，左边是音符模式，右边是下一个音符。最后一行是第一行乐谱。<br></div><div class="panel_bottom" style="height: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><br><div class="panel_title" align="left" style="height: 38px; background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding-top: 0px; padding-right: 14px; padding-bottom: 0px; padding-left: 14px; color: rgb(124, 169, 237); font-size: 18px; font-family: Arial; font-weight: bold; line-height: normal; background-position: 0% 100%; background-repeat: no-repeat no-repeat; ">Output</div><div class="panel_content" style="height: auto; background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 20px; padding-bottom: 0px; padding-left: 20px; font-size: 14px; font-family: 'Times New Roman'; text-align: left; color: rgb(0, 0, 0); line-height: normal; background-repeat: no-repeat repeat; ">输出M行，表示M行乐谱。</div><div class="panel_bottom" style="height: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><br><div class="panel_title" align="left" style="height: 38px; background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding-top: 0px; padding-right: 14px; padding-bottom: 0px; padding-left: 14px; color: rgb(124, 169, 237); font-size: 18px; font-family: Arial; font-weight: bold; line-height: normal; background-position: 0% 100%; background-repeat: no-repeat no-repeat; ">Sample Input</div><div class="panel_content" style="height: auto; background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 20px; padding-bottom: 0px; padding-left: 20px; font-size: 14px; font-family: 'Times New Roman'; text-align: left; color: rgb(0, 0, 0); line-height: normal; background-repeat: no-repeat repeat; "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; "><div style="font-family: 'Courier New', Courier, monospace; ">1
16
111 1
110 1
101 1
100 1
011 1
010 0
001 1
000 0
0000000000000001000000000000000</div></pre></div><div class="panel_bottom" style="height: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><br><div class="panel_title" align="left" style="height: 38px; background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding-top: 0px; padding-right: 14px; padding-bottom: 0px; padding-left: 14px; color: rgb(124, 169, 237); font-size: 18px; font-family: Arial; font-weight: bold; line-height: normal; background-position: 0% 100%; background-repeat: no-repeat no-repeat; ">Sample Output</div><div class="panel_content" style="height: auto; background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 20px; padding-bottom: 0px; padding-left: 20px; font-size: 14px; font-family: 'Times New Roman'; text-align: left; color: rgb(0, 0, 0); line-height: normal; background-repeat: no-repeat repeat; "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; "><div style="font-family: 'Courier New', Courier, monospace; ">0000000000000001000000000000000
0000000000000010100000000000000
0000000000000101010000000000000
0000000000001010101000000000000
0000000000010101010100000000000
0000000000101010101010000000000
0000000001010101010101000000000
0000000010101010101010100000000
0000000101010101010101010000000
0000001010101010101010101000000
0000010101010101010101010100000
0000101010101010101010101010000
0001010101010101010101010101000
0010101010101010101010101010100
0101010101010101010101010101010
1010101010101010101010101010101</div></pre></div><div class="panel_bottom" style="height: auto; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><br></div><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; ">&nbsp;</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; ">题目分析 :</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; ">	</span>纯水 模拟题.......... &nbsp; &nbsp; &nbsp;就是 由 上面 3 个 格子的 颜色 推出下面 中间那块的 颜色. &nbsp;推出来直接输出就可以了 .</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; ">&nbsp;<span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; ">	</span>题目开始已经给出了第一行的 颜色 , 下面的可以直接 暴力推出来 &nbsp;用hash很快就能判断.</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: rgb(0, 0, 0); font-family: 'Times New Roman'; line-height: normal; font-size: medium; ">代码如下 :</p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  color="#000000" face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">&nbsp;/*</span></font></p></font><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">Coded By &nbsp;: MiYu</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">Link &nbsp; &nbsp; &nbsp;: http://www.cnblogs.com/MiYu &nbsp;|| http://www.cppblog.com/MiYu</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">Author By : MiYu</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">Test &nbsp; &nbsp; &nbsp;: 1</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">Program &nbsp; : 2526</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">*/</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">//#pragma warning( disable:4789 )</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">#include &lt;iostream&gt;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">#include &lt;cstdio&gt;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">#include &lt;cstring&gt;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">using namespace std;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">char c[2][50];</span></font><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">int T,t,M;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">int main(){</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">&nbsp;&nbsp; &nbsp;char a[3],b[9];</span></font><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">for(int i=0;i&lt;2;i++) c[i][0]='0';</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">scanf("%d",&amp;T);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">while(T--){</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">scanf("%d",&amp;M);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">for(int i=1;i&lt;=8;i++){</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">scanf("%s",a);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">int num=(a[0]-'0')*4+(a[1]-'0')*2+a[2]-'0';</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">scanf("%d",&amp;t);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">b[num] = '0' + t;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">}</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">scanf("%s",&amp;c[0][1]);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">int len=strlen(&amp;c[0][1]);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">for(int i=0;i&lt;2;i++) c[i][len+1]='0';</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">for(int j=0;j&lt;M;j++){</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">for(int i=0;i&lt;len;i++){</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">				</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">int num=(c[j%2][i]-'0')*4+(c[j%2][i+1]-'0')*2+c[j%2][i+2]-'0';</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">				</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">c[(j+1)%2][i+1]=b[num];</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf("%c",c[j%2][i+1]);</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">			</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">}</span></font><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;printf("\n");</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">		</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">}</span></font><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">}</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><span class="Apple-tab-span" style="font-family: 'Courier New'; white-space: pre; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">	</span></font></span><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">return 0;</span></font></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; "><font  face="'Times New Roman'"><span  style="font-family: 'Courier New'; line-height: normal; font-size: medium; ">}</span></font></p></div><div><br></div></div><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; "></p><p style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px; ">&nbsp;</p>
<img src ="http://www.cppblog.com/MiYu/aggbug/127770.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-09-26 16:42 <a href="http://www.cppblog.com/MiYu/archive/2010/09/26/127770.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1008 Elevator ACM 1008 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/08/122705.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sun, 08 Aug 2010 14:21:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/08/122705.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122705.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/08/122705.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122705.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122705.html</trackback:ping><description><![CDATA[<span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/"><font color=#1d58d1>______________白白の屋</font></a><br><br>题目地址:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1008">http://acm.hdu.edu.cn/showproblem.php?pid=1008</a><br>题目描述:<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"><span style="COLOR: #000000">Problem&nbsp;Description<br>The&nbsp;highest&nbsp;building&nbsp;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&nbsp;our&nbsp;city&nbsp;has&nbsp;only&nbsp;one&nbsp;elevator.&nbsp;A&nbsp;request&nbsp;list&nbsp;</span><span style="COLOR: #0000ff">is</span><span style="COLOR: #000000">&nbsp;made&nbsp;up&nbsp;with&nbsp;N&nbsp;positive&nbsp;numbers.&nbsp;The&nbsp;numbers&nbsp;denote&nbsp;at&nbsp;which&nbsp;floors&nbsp;the&nbsp;elevator&nbsp;will&nbsp;stop,&nbsp;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&nbsp;specified&nbsp;order.&nbsp;It&nbsp;costs&nbsp;</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">&nbsp;seconds&nbsp;to&nbsp;move&nbsp;the&nbsp;elevator&nbsp;up&nbsp;one&nbsp;floor,&nbsp;and&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">&nbsp;seconds&nbsp;to&nbsp;move&nbsp;down&nbsp;one&nbsp;floor.&nbsp;The&nbsp;elevator&nbsp;will&nbsp;stay&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">&nbsp;seconds&nbsp;at&nbsp;each&nbsp;stop.<br><br>For&nbsp;a&nbsp;given&nbsp;request&nbsp;list,&nbsp;you&nbsp;are&nbsp;to&nbsp;compute&nbsp;the&nbsp;total&nbsp;time&nbsp;spent&nbsp;to&nbsp;fulfill&nbsp;the&nbsp;requests&nbsp;on&nbsp;the&nbsp;list.&nbsp;The&nbsp;elevator&nbsp;</span><span style="COLOR: #0000ff">is</span><span style="COLOR: #000000">&nbsp;on&nbsp;the&nbsp;0th&nbsp;floor&nbsp;at&nbsp;the&nbsp;beginning&nbsp;and&nbsp;does&nbsp;not&nbsp;have&nbsp;to&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;to&nbsp;the&nbsp;ground&nbsp;floor&nbsp;when&nbsp;the&nbsp;requests&nbsp;are&nbsp;fulfilled.<br>&nbsp;<br><br>Input<br>There&nbsp;are&nbsp;multiple&nbsp;test&nbsp;cases.&nbsp;Each&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;contains&nbsp;a&nbsp;positive&nbsp;integer&nbsp;N,&nbsp;followed&nbsp;by&nbsp;N&nbsp;positive&nbsp;numbers.&nbsp;All&nbsp;the&nbsp;numbers&nbsp;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&nbsp;the&nbsp;input&nbsp;are&nbsp;less&nbsp;than&nbsp;</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">.&nbsp;A&nbsp;test&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;with&nbsp;N&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;denotes&nbsp;the&nbsp;end&nbsp;of&nbsp;input.&nbsp;This&nbsp;test&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">is</span><span style="COLOR: #000000">&nbsp;not&nbsp;to&nbsp;be&nbsp;processed.<br>&nbsp;<br><br>Output<br>Print&nbsp;the&nbsp;total&nbsp;time&nbsp;on&nbsp;a&nbsp;single&nbsp;line&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;each&nbsp;test&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">.&nbsp;<br>&nbsp;<br><br>Sample&nbsp;Input<br></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">0</span></div>
</span><br>又是一个水到极点的模拟............<br>直接代码:<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"><span style="COLOR: #000000">#include&nbsp;</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: #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: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;T;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;T&nbsp;,&nbsp;T&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;beg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;,&nbsp;stop&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;sum&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;T;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;stop;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;stop&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;beg&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;(&nbsp;stop&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;beg&nbsp;)&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;(&nbsp;beg&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;stop&nbsp;)&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;stop;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;sum&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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;<br>}&nbsp;<br></span></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122705.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-08 22:21 <a href="http://www.cppblog.com/MiYu/archive/2010/08/08/122705.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1228 A + B ACM 1228 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/08/122704.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sun, 08 Aug 2010 14:18:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/08/122704.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122704.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/08/122704.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122704.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122704.html</trackback:ping><description><![CDATA[<p><span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/"><font color=#1d58d1>______________白白の屋</font></a></span></p>
<br>题目地址:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1228">http://acm.hdu.edu.cn/showproblem.php?pid=1228</a><br>题目描述:<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"><span style="COLOR: #000000">Problem&nbsp;Description<br>读入两个小于100的正整数A和B,计算A</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">B.<br>需要注意的是:A和B的每一位数字由对应的英文单词给出.<br>&nbsp;<br><br>Input<br>测试输入包含若干测试用例,每个测试用例占一行,格式为</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">A&nbsp;+&nbsp;B&nbsp;=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出.&nbsp;<br>&nbsp;<br><br>Output<br>对每个测试用例输出1行,即A</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">B的值.<br>&nbsp;<br><br>Sample&nbsp;Input<br>one&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;two&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br>three&nbsp;four&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;five&nbsp;six&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br>zero&nbsp;seven&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;eight&nbsp;nine&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br>zero&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;zero&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br>&nbsp;<br><br>Sample&nbsp;Output<br></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">90</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">96</span></div>
<br>简单的模拟题, 没什么技巧 <br>代码如下:<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: 12pt; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #000000"><span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/"><font color=#1d58d1>______________白白の屋</font></a></span><br><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</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: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br>map&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;mp;<br></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setMap&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">one</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">two</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">three</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">four</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">five</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">six</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">seven</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">7</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">eight</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">nine</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mp[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">zero</span><span style="COLOR: #000000">"</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;&nbsp;<br>}<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;setMap&nbsp;();<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;a&nbsp;,&nbsp;b,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;a&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;sum1&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;mp[a];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;b&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum1&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;sum1&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;mp[b];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;sum2&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;mp[b];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;b&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum2&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;sum2&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;mp[b];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;sum1&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sum2&nbsp;&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;sum1&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;sum2&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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;<br>}&nbsp;<br></span></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122704.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-08 22:18 <a href="http://www.cppblog.com/MiYu/archive/2010/08/08/122704.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1032 The 3n + 1 problem ACM 1032 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/08/122692.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sun, 08 Aug 2010 12:31:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/08/122692.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122692.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/08/122692.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122692.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122692.html</trackback:ping><description><![CDATA[<span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/"><font color=#1d58d1>______________白白の屋</font></a></span><br><br>题目地址:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1032">http://acm.hdu.edu.cn/showproblem.php?pid=1032</a><br><br>水题,不解释..........................<br><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: 12pt; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #000000"><span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/"><font color=#1d58d1>______________白白の屋</font></a></span><br><br>#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Length(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n)<br>{<br>&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">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(n</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(n</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n</span><span style="COLOR: #000000">/=</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br>}<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main(&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,j,temp,max,t,small,large;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">i)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">EOF)&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&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">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">j)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;small</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i;large</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">j;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;{&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;small</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">j;large</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temp</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">small;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;max</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Length(temp);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(temp</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">large)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Length(temp);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(t</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">max)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;max</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">t;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temp</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d&nbsp;%d&nbsp;%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,i,j,max);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122692.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-08 20:31 <a href="http://www.cppblog.com/MiYu/archive/2010/08/08/122692.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 2053 Switch Game ACM 2053 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/07/122528.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sat, 07 Aug 2010 07:20:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/07/122528.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122528.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/07/122528.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122528.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122528.html</trackback:ping><description><![CDATA[MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a><br><br>题目地址:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=2053">http://acm.hdu.edu.cn/showproblem.php?pid=2053</a><br>题目描述:<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"><span style="COLOR: #000000">Problem&nbsp;Description<br>There&nbsp;are&nbsp;many&nbsp;lamps&nbsp;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&nbsp;a&nbsp;line.&nbsp;All&nbsp;of&nbsp;them&nbsp;are&nbsp;off&nbsp;at&nbsp;first.&nbsp;A&nbsp;series&nbsp;of&nbsp;operations&nbsp;are&nbsp;carried&nbsp;</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">&nbsp;on&nbsp;these&nbsp;lamps.&nbsp;On&nbsp;the&nbsp;i</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">th&nbsp;operation,&nbsp;the&nbsp;lamps&nbsp;whose&nbsp;numbers&nbsp;are&nbsp;the&nbsp;multiple&nbsp;of&nbsp;i&nbsp;change&nbsp;the&nbsp;condition&nbsp;(&nbsp;on&nbsp;to&nbsp;off&nbsp;and&nbsp;off&nbsp;to&nbsp;on&nbsp;).<br>&nbsp;<br><br>Input<br>Each&nbsp;test&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;contains&nbsp;only&nbsp;a&nbsp;number&nbsp;n&nbsp;(&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;n</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">^</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&nbsp;a&nbsp;line.<br>&nbsp;<br><br>Output<br>Output&nbsp;the&nbsp;condition&nbsp;of&nbsp;the&nbsp;n</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">th&nbsp;lamp&nbsp;after&nbsp;infinity&nbsp;operations&nbsp;(&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;off,&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;on&nbsp;).<br>&nbsp;<br><br>Sample&nbsp;Input<br></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">5</span><span style="COLOR: #000000"><br>&nbsp;<br><br>Sample&nbsp;Output<br></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">0</span><span style="COLOR: #000000"><br><br>Hint<br>hint<br>&nbsp;<br><br>Consider&nbsp;the&nbsp;second&nbsp;test&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">:<br><br>The&nbsp;initial&nbsp;condition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;&#8230;<br>After&nbsp;the&nbsp;first&nbsp;operation&nbsp;&nbsp;:&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;&#8230;<br>After&nbsp;the&nbsp;second&nbsp;operation&nbsp;:&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;&#8230;<br>After&nbsp;the&nbsp;third&nbsp;operation&nbsp;&nbsp;:&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;&#8230;<br>After&nbsp;the&nbsp;fourth&nbsp;operation&nbsp;:&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;&#8230;<br>After&nbsp;the&nbsp;fifth&nbsp;operation&nbsp;&nbsp;:&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;&#8230;<br><br>The&nbsp;later&nbsp;operations&nbsp;cannot&nbsp;change&nbsp;the&nbsp;condition&nbsp;of&nbsp;the&nbsp;fifth&nbsp;lamp&nbsp;any&nbsp;more.&nbsp;So&nbsp;the&nbsp;answer&nbsp;</span><span style="COLOR: #0000ff">is</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">.</span></div>
<br>题目分析:<br><span style="COLOR: #993300">毫无疑问 , 从后面的 Consider&nbsp;the&nbsp;second&nbsp;test&nbsp;case 可以看出, 这是一道模拟题, 根据题意直接模拟即可!</span><br><br>代码如下:<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"><span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a><br><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></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>&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;arr[</span><span style="COLOR: #000000">100001</span><span style="COLOR: #000000">];<br>&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">n)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;EOF)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset(arr,&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(arr));<br>&nbsp;&nbsp;&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;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;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">j</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">n;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">j)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arr[j</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">arr[j</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">i];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;arr[n]);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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></div>
<br>但是这样非常耗时,&nbsp; 有没更简单的方法? 当然有!&nbsp; 在草稿纸上模拟后得出: 只要是平方数就是 "1" ,否则为"0" , 所以<br>直接哈希,0MS过.<br><br>代码如下:<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"><span style="COLOR: #000000"><span style="COLOR: #000000">MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>#include&nbsp;</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: #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: #0000ff">int</span><span style="COLOR: #000000">&nbsp;F[</span><span style="COLOR: #000000">100001</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;{&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;};<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">100000</span><span style="COLOR: #000000">&nbsp;;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F[&nbsp;i&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;i&nbsp;]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;N;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;N&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;(&nbsp;F[N]&nbsp;</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;:&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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;<br>}<br></span></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122528.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-07 15:20 <a href="http://www.cppblog.com/MiYu/archive/2010/08/07/122528.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1982 Kaitou Kid - The Phantom Thief(1) ACM 1982 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/04/122236.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Wed, 04 Aug 2010 12:04:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/04/122236.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122236.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/04/122236.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122236.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122236.html</trackback:ping><description><![CDATA[<span style="COLOR: red"><span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>题目地址 :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1982">http://acm.hdu.edu.cn/showproblem.php?pid=1982</a><br><br>PE了N次, 很纠结的一个题........&nbsp; 题目如下 :</span><br><span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium 'Times New Roman'; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span class=Apple-style-span>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-title.png); PADDING-BOTTOM: 0px; BACKGROUND-COLOR: transparent; PADDING-LEFT: 14px; PADDING-RIGHT: 14px; FONT-FAMILY: Arial; BACKGROUND-POSITION: 0% 100%; HEIGHT: 38px; COLOR: rgb(124,169,237); FONT-SIZE: 18px; FONT-WEIGHT: bold; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_title align=left>Problem Description</div>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-content.png); TEXT-ALIGN: left; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: 'Times New Roman'; HEIGHT: auto; FONT-SIZE: 14px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_content>Do you know Kaitou Kid? In the legend, Kaitou Kid is a master of disguise, and can take on the voice and form of anyone. He is not an evil person, but he is on the wrong side of the law. He's the very elusive phantom thief who never miss his prey although he always uses word puzzles to announce his targets before action.<br><br>You are the leader of a museum. Recently, you get several priceless jewels and plan to hold an exhibition. But at the moment, you receive Kid's word puzzle... Fortunately, It seems Kid doesn&#8217;t want to trouble you, and his puzzle is very easy. Just a few minutes, You have found the way to solve the puzzle:<br><br>(1) change 1 to 'A', 2 TO 'B',..,26 TO 'Z'<br>(2) change '#' to a blank<br>(3) ignore the '-' symbol, it just used to separate the numbers in the puzzle</div>
<br>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-title.png); PADDING-BOTTOM: 0px; BACKGROUND-COLOR: transparent; PADDING-LEFT: 14px; PADDING-RIGHT: 14px; FONT-FAMILY: Arial; BACKGROUND-POSITION: 0% 100%; HEIGHT: 38px; COLOR: rgb(124,169,237); FONT-SIZE: 18px; FONT-WEIGHT: bold; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_title align=left>Input</div>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-content.png); TEXT-ALIGN: left; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: 'Times New Roman'; HEIGHT: auto; FONT-SIZE: 14px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_content>The first line of the input contains an integer C which means the number of test cases. Then C lines follow. Each line is a sentence of Kid&#8217;s word puzzle which is consisted of '0' ~ '9' , '-' and '#'. The length of each sentence is no longer than 10000.</div>
<br>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-title.png); PADDING-BOTTOM: 0px; BACKGROUND-COLOR: transparent; PADDING-LEFT: 14px; PADDING-RIGHT: 14px; FONT-FAMILY: Arial; BACKGROUND-POSITION: 0% 100%; HEIGHT: 38px; COLOR: rgb(124,169,237); FONT-SIZE: 18px; FONT-WEIGHT: bold; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_title align=left>Output</div>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-content.png); TEXT-ALIGN: left; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: 'Times New Roman'; HEIGHT: auto; FONT-SIZE: 14px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_content>For each case, output the translated text.</div>
<br>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-title.png); PADDING-BOTTOM: 0px; BACKGROUND-COLOR: transparent; PADDING-LEFT: 14px; PADDING-RIGHT: 14px; FONT-FAMILY: Arial; BACKGROUND-POSITION: 0% 100%; HEIGHT: 38px; COLOR: rgb(124,169,237); FONT-SIZE: 18px; FONT-WEIGHT: bold; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_title align=left>Sample Input</div>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-content.png); TEXT-ALIGN: left; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: 'Times New Roman'; HEIGHT: auto; FONT-SIZE: 14px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_content>
<pre style="MARGIN: 0px; FONT-SIZE: 14px">
<div style="FONT-FAMILY: 'Courier New', Courier, monospace">4
9#23-9-12-12#19-20-5-1-12#1-20#12-5-1-19-20#15-14-5#10-5-23-5-12
1-14-4#12-5-1-22-5#20-8-5#13-21-19-5-21-13#9-14#20#13-9-14-21-20-5-19
1-6-20-5-18#20-8-5#15-16-5-14-9-14-7#15-6#20-8-5#5-24-8-9-2-9-20-9-15-14
7-15-15-4#12-21-3-11</div>
</pre>
</div>
<br>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-title.png); PADDING-BOTTOM: 0px; BACKGROUND-COLOR: transparent; PADDING-LEFT: 14px; PADDING-RIGHT: 14px; FONT-FAMILY: Arial; BACKGROUND-POSITION: 0% 100%; HEIGHT: 38px; COLOR: rgb(124,169,237); FONT-SIZE: 18px; FONT-WEIGHT: bold; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_title align=left>Sample Output</div>
<div style="BACKGROUND-IMAGE: url(http://acm.hdu.edu.cn/images/panel-content.png); TEXT-ALIGN: left; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: 'Times New Roman'; HEIGHT: auto; FONT-SIZE: 14px; PADDING-TOP: 0px; background-origin: initial; background-clip: initial" class=panel_content>
<pre style="MARGIN: 0px; FONT-SIZE: 14px">
<div style="FONT-FAMILY: 'Courier New', Courier, monospace">I WILL STEAL AT LEAST ONE JEWEL
AND LEAVE THE MUSEUM IN T MINUTES
AFTER THE OPENING OF THE EXHIBITION
GOOD LUCK</div>
</pre>
</div>
</span></span><br class=Apple-interchange-newline><br>刚开始是用的库函数 strtok 对字符串进行处理,&nbsp; 直接敲完,没有出现错误, 提交,悲剧开始了<br><img border=0 src="http://www.cppblog.com/images/cppblog_com/miyu/1982.jpg"><br>下面的是<span style="COLOR: red">PE</span> 的代码 :<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"><span style="COLOR: #000000"><span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstring</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></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: #0000ff">char</span><span style="COLOR: #000000">&nbsp;psw[</span><span style="COLOR: #000000">10005</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;sym[</span><span style="COLOR: #000000">133</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setSym&nbsp;(&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;ch;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;ch&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">,&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;,&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;ch&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sym[i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;ch&nbsp;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>}&nbsp;<br></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;prs&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">psw&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;str;<br>&nbsp;&nbsp;&nbsp;&nbsp;&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;strlen&nbsp;(&nbsp;psw&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;n;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw[i]&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;psw[i]&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;num&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;sym[num];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;num&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;sym[num];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;str;<br>}<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;setSym&nbsp;();<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;T;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;scanf&nbsp;(&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">T&nbsp;)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;EOF&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;T&nbsp;</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets&nbsp;(&nbsp;psw&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;str;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">ptr&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;strtok&nbsp;(&nbsp;psw,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;strlen&nbsp;(&nbsp;ptr&nbsp;)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;prs&nbsp;(&nbsp;ptr&nbsp;);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;ptr&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;strtok&nbsp;(&nbsp;NULL,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;)&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;strcmp&nbsp;(&nbsp;ptr,&nbsp;</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">&nbsp;)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;prs&nbsp;(&nbsp;ptr&nbsp;);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;str&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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;<br>}<br></span></div>
<br>&nbsp;最后在Ambition 大牛的提示下,成功AC, 因为strtok是忽视被截字符串的个数的 "-----######---##-#-#"<br>这组数据应该输出10个空格, 而我的代码值能输出3个.<br>下面的是<span style="COLOR: red">AC</span>代码 :<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"><span style="COLOR: #000000"><span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstring</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></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: #0000ff">char</span><span style="COLOR: #000000">&nbsp;psw[</span><span style="COLOR: #000000">20005</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;temp[</span><span style="COLOR: #000000">20005</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;sym[</span><span style="COLOR: #000000">133</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setSym&nbsp;(&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;ch;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;ch&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">,&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;,&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;ch&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sym[i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;ch&nbsp;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>}&nbsp;<br></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;prs&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">psw&nbsp;)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;str;<br>&nbsp;&nbsp;&nbsp;&nbsp;&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;strlen&nbsp;(&nbsp;psw&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;n;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">&nbsp;i&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw[i]&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;psw[i]&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;num&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;sym[num];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;num&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;sym[num];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;str;<br>}<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main&nbsp;()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;setSym&nbsp;();<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;T;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;scanf&nbsp;(&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">T&nbsp;)&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;EOF&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getchar&nbsp;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;T&nbsp;</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets&nbsp;(&nbsp;psw&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;len&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;strlen&nbsp;(&nbsp;psw&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;beg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset&nbsp;(&nbsp;temp,&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">&nbsp;(&nbsp;temp&nbsp;)&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;str;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw[beg]&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw[beg]&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;psw[beg]&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temp[i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;psw[beg</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">];&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temp[i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;t&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;prs&nbsp;(&nbsp;temp&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;t.size()&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;t;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw[beg]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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">&nbsp;(&nbsp;psw[beg]&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beg&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;str&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset&nbsp;(&nbsp;psw,&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">&nbsp;(&nbsp;psw&nbsp;)&nbsp;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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;<br>}<br></span></div>
<br>弄了一个下午加一个晚上才 AC , 是自己把简单问题想太复杂了............<br><span style="COLOR: red">Roowe 神牛代码</span> :<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"><span style="COLOR: #000000"><span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ctype.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></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: #0000ff">char</span><span style="COLOR: #000000">&nbsp;str[</span><span style="COLOR: #000000">27</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">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">};<br></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;s[</span><span style="COLOR: #000000">10001</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;T,len,i,num;<br>&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">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">T);<br>&nbsp;&nbsp;&nbsp;&nbsp;getchar();<br>&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>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets(s);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;len</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strlen(s);<br>&nbsp;&nbsp;&nbsp;&nbsp;&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">;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(isdigit(s[i])&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;isdigit(s[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(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">)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">s[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%c</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,str[num</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(isdigit(s[i])&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">isdigit(s[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%c</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,str[num</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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">)&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&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></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-04 20:04 <a href="http://www.cppblog.com/MiYu/archive/2010/08/04/122236.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1088 Write a simple HTML Browser ACM 1088 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/04/122201.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Wed, 04 Aug 2010 06:07:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/04/122201.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122201.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/04/122201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122201.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122201.html</trackback:ping><description><![CDATA[<span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><br><br>题目地址 :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://acm.hdu.edu.cn/showproblem.php?pid=1088">http://acm.hdu.edu.cn/showproblem.php?pid=1088</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模拟HTML 语言...............<br>标准的模拟题..............PE了好久, 终于A 了<br>代码如下 :<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"><span style="COLOR: #000000">//MiYu原创, 转帖请注明 : 转载自 <a href="http://www.cppblog.com/MiYu/">______________白白の屋</a></span><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><br><span style="COLOR: #000000">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></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><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;hr&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">--------------------------------------------------------------------------------</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br><img id=Codehighlighter1_165_1026_Open_Image onclick="this.style.display='none'; Codehighlighter1_165_1026_Open_Text.style.display='none'; Codehighlighter1_165_1026_Closed_Image.style.display='inline'; Codehighlighter1_165_1026_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_165_1026_Closed_Image onclick="this.style.display='none'; Codehighlighter1_165_1026_Closed_Text.style.display='none'; Codehighlighter1_165_1026_Open_Image.style.display='inline'; Codehighlighter1_165_1026_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_165_1026_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_165_1026_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;str,&nbsp;str1;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;count&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(&nbsp;cin&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;str&nbsp;)<br><img id=Codehighlighter1_237_992_Open_Image onclick="this.style.display='none'; Codehighlighter1_237_992_Open_Text.style.display='none'; Codehighlighter1_237_992_Closed_Image.style.display='inline'; Codehighlighter1_237_992_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_237_992_Closed_Image onclick="this.style.display='none'; Codehighlighter1_237_992_Closed_Text.style.display='none'; Codehighlighter1_237_992_Open_Image.style.display='inline'; Codehighlighter1_237_992_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_237_992_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_237_992_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;len&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;str.size&nbsp;();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;str&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;br&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;)<br><img id=Codehighlighter1_307_367_Open_Image onclick="this.style.display='none'; Codehighlighter1_307_367_Open_Text.style.display='none'; Codehighlighter1_307_367_Closed_Image.style.display='inline'; Codehighlighter1_307_367_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_307_367_Closed_Image onclick="this.style.display='none'; Codehighlighter1_307_367_Closed_Text.style.display='none'; Codehighlighter1_307_367_Open_Image.style.display='inline'; Codehighlighter1_307_367_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&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_307_367_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_307_367_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&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">&nbsp;(&nbsp;str&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;hr&gt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;)<br><img id=Codehighlighter1_411_561_Open_Image onclick="this.style.display='none'; Codehighlighter1_411_561_Open_Text.style.display='none'; Codehighlighter1_411_561_Closed_Image.style.display='inline'; Codehighlighter1_411_561_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_411_561_Closed_Image onclick="this.style.display='none'; Codehighlighter1_411_561_Closed_Text.style.display='none'; Codehighlighter1_411_561_Open_Image.style.display='inline'; Codehighlighter1_411_561_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&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_411_561_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_411_561_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;count&nbsp;)<br><img id=Codehighlighter1_450_496_Open_Image onclick="this.style.display='none'; Codehighlighter1_450_496_Open_Text.style.display='none'; Codehighlighter1_450_496_Closed_Image.style.display='inline'; Codehighlighter1_450_496_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_450_496_Closed_Image onclick="this.style.display='none'; Codehighlighter1_450_496_Closed_Text.style.display='none'; Codehighlighter1_450_496_Open_Image.style.display='inline'; Codehighlighter1_450_496_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;&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_450_496_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_450_496_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;&nbsp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;hr&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_584_986_Open_Image onclick="this.style.display='none'; Codehighlighter1_584_986_Open_Text.style.display='none'; Codehighlighter1_584_986_Closed_Image.style.display='inline'; Codehighlighter1_584_986_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_584_986_Closed_Image onclick="this.style.display='none'; Codehighlighter1_584_986_Closed_Text.style.display='none'; Codehighlighter1_584_986_Open_Image.style.display='inline'; Codehighlighter1_584_986_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&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_584_986_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_584_986_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;count&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;len&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">80</span><span style="COLOR: #000000">&nbsp;)&nbsp;<br><img id=Codehighlighter1_640_843_Open_Image onclick="this.style.display='none'; Codehighlighter1_640_843_Open_Text.style.display='none'; Codehighlighter1_640_843_Closed_Image.style.display='inline'; Codehighlighter1_640_843_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_640_843_Closed_Image onclick="this.style.display='none'; Codehighlighter1_640_843_Closed_Text.style.display='none'; Codehighlighter1_640_843_Open_Image.style.display='inline'; Codehighlighter1_640_843_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;&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_640_843_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_640_843_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(&nbsp;count&nbsp;)<br><img id=Codehighlighter1_687_770_Open_Image onclick="this.style.display='none'; Codehighlighter1_687_770_Open_Text.style.display='none'; Codehighlighter1_687_770_Closed_Image.style.display='inline'; Codehighlighter1_687_770_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_687_770_Closed_Image onclick="this.style.display='none'; Codehighlighter1_687_770_Closed_Text.style.display='none'; Codehighlighter1_687_770_Open_Image.style.display='inline'; Codehighlighter1_687_770_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;&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_687_770_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_687_770_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;str;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;len;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_874_976_Open_Image onclick="this.style.display='none'; Codehighlighter1_874_976_Open_Text.style.display='none'; Codehighlighter1_874_976_Closed_Image.style.display='inline'; Codehighlighter1_874_976_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_874_976_Closed_Image onclick="this.style.display='none'; Codehighlighter1_874_976_Closed_Text.style.display='none'; Codehighlighter1_874_976_Open_Image.style.display='inline'; Codehighlighter1_874_976_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;&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_874_976_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_874_976_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;len;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;str;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;endl;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&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><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span></div>
<img src ="http://www.cppblog.com/MiYu/aggbug/122201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/MiYu/" target="_blank">MiYu</a> 2010-08-04 14:07 <a href="http://www.cppblog.com/MiYu/archive/2010/08/04/122201.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>