﻿<?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++博客-zhuxin-文章分类-数学</title><link>http://www.cppblog.com/zhuxin/category/20121.html</link><description /><language>zh-cn</language><lastBuildDate>Sun, 04 Nov 2012 11:49:34 GMT</lastBuildDate><pubDate>Sun, 04 Nov 2012 11:49:34 GMT</pubDate><ttl>60</ttl><item><title>贝叶斯公式</title><link>http://www.cppblog.com/zhuxin/articles/193830.html</link><dc:creator>zhuxin</dc:creator><author>zhuxin</author><pubDate>Thu, 25 Oct 2012 04:38:00 GMT</pubDate><guid>http://www.cppblog.com/zhuxin/articles/193830.html</guid><wfw:comment>http://www.cppblog.com/zhuxin/comments/193830.html</wfw:comment><comments>http://www.cppblog.com/zhuxin/articles/193830.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zhuxin/comments/commentRss/193830.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zhuxin/services/trackbacks/193830.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在讲贝叶斯公式之前，我必须先提一下条件概率和全概率公式。<br />&nbsp;<span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #ff0000">条件概率</span><span style="color: #ff0000">：</span>设A，B是两个事件，且P(B)&nbsp;&gt; 0，称<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<dl>
<dd>
<dl>
<dd><img class="tex" alt="P(A|B) = \frac{P(A \cap B)}{P(B)}" src="http://upload.wikimedia.org/math/8/6/9/8694e4193ba45b55403595096b7d23c5.png" /></dd></dl></dd></dl>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为在事件B发生的条件下，事件A发生的条件概率。<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;例子：袋中有7个黑球和3个白球，从中无放回地随机抽取3个球，已知其中有黑球，试求取得2个黑球1个白球的概率。<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设A = {抽取的3个球有黑球}；B = {取得2个黑球1个白球}。故所求事件的概率为P(B|A)。利用条件概率定义计算。此时样本空间中的样本点总数n = C(10，3)，事件A包含的样本点数k1 = C(7，1) * C(3，2) + C(7，2) * C(3，1) + C(7，3) = 119，事件AB包含的样本点数k2 = C(7，2) * C(3，1) = 63.则<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P(B | A) = P(BA) / P(A) = (k2 / n) / (k1 / n) = k2 / k1 = 63 / 119。<br />&nbsp;&nbsp;<span style="color: #ff0000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #ff0000">全</span><span style="color: #ff0000">概率：</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/zhuxin/1.jpg" width="512" height="123" /><br />&nbsp;&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/zhuxin/44.jpg" width="572" height="458" />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff0000">&nbsp;贝叶斯：<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/zhuxin/511.jpg" width="584" height="78" /><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/zhuxin/512.jpg" width="585" height="88" />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/zhuxin/72.jpg" width="579" height="447" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/Files/zhuxin/概率论.pdf">/Files/zhuxin/概率论.pdf</a></span></p><img src ="http://www.cppblog.com/zhuxin/aggbug/193830.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zhuxin/" target="_blank">zhuxin</a> 2012-10-25 12:38 <a href="http://www.cppblog.com/zhuxin/articles/193830.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>逆序数</title><link>http://www.cppblog.com/zhuxin/articles/193697.html</link><dc:creator>zhuxin</dc:creator><author>zhuxin</author><pubDate>Mon, 22 Oct 2012 14:38:00 GMT</pubDate><guid>http://www.cppblog.com/zhuxin/articles/193697.html</guid><wfw:comment>http://www.cppblog.com/zhuxin/comments/193697.html</wfw:comment><comments>http://www.cppblog.com/zhuxin/articles/193697.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zhuxin/comments/commentRss/193697.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zhuxin/services/trackbacks/193697.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设A[0 .. n - 1]是一个包含n个不同数的数组。如果在i &lt; j的情况下，有A[i] &gt; A[j]，则(i, j)就称为A中的一个逆序对Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighl...&nbsp;&nbsp;<a href='http://www.cppblog.com/zhuxin/articles/193697.html'>阅读全文</a><img src ="http://www.cppblog.com/zhuxin/aggbug/193697.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zhuxin/" target="_blank">zhuxin</a> 2012-10-22 22:38 <a href="http://www.cppblog.com/zhuxin/articles/193697.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>求x的n次方</title><link>http://www.cppblog.com/zhuxin/articles/193641.html</link><dc:creator>zhuxin</dc:creator><author>zhuxin</author><pubDate>Sun, 21 Oct 2012 15:55:00 GMT</pubDate><guid>http://www.cppblog.com/zhuxin/articles/193641.html</guid><wfw:comment>http://www.cppblog.com/zhuxin/comments/193641.html</wfw:comment><comments>http://www.cppblog.com/zhuxin/articles/193641.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zhuxin/comments/commentRss/193641.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zhuxin/services/trackbacks/193641.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img id="Codehighlighter1_0_33_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_33_Open_Text.style.display='none'; Codehighlighter1_0_33_Closed_Image.style.display='inline'; Codehighlighter1_0_33_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_0_33_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_0_33_Closed_Text.style.display='none'; Codehighlighter1_0_33_Open_Image.style.display='inline'; Codehighlighter1_0_33_Open_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif"><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_0_33_Closed_Text">/**/</span><span id="Codehighlighter1_0_33_Open_Text"><span style="color: #008000">/*</span><span style="color: #008000"><br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;名称：乘方<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;时间复杂度：O（lg（n））<br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #008000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" /></span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />#include&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: #008080">&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">using</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">namespace</span><span style="color: #000000">&nbsp;std;<br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />__int64&nbsp;power(</span><span style="color: #0000ff">int</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">);<br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;main(</span><span style="color: #0000ff">void</span><span style="color: #000000">)<br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img id="Codehighlighter1_116_235_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_235_Open_Text.style.display='none'; Codehighlighter1_116_235_Closed_Image.style.display='inline'; Codehighlighter1_116_235_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_116_235_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_116_235_Closed_Text.style.display='none'; Codehighlighter1_116_235_Open_Image.style.display='inline'; Codehighlighter1_116_235_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_116_235_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_116_235_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;x,&nbsp;n;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">while</span><span style="color: #000000">&nbsp;(</span><span style="color: #0000ff">true</span><span style="color: #000000">)<br /></span><span style="color: #008080">12</span><span style="color: #000000"><img id="Codehighlighter1_153_219_Open_Image" onclick="this.style.display='none'; Codehighlighter1_153_219_Open_Text.style.display='none'; Codehighlighter1_153_219_Closed_Image.style.display='inline'; Codehighlighter1_153_219_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_153_219_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_153_219_Closed_Text.style.display='none'; Codehighlighter1_153_219_Open_Image.style.display='inline'; Codehighlighter1_153_219_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_153_219_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_153_219_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&nbsp;</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">&nbsp;x&nbsp;</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">&nbsp;n;<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">&nbsp;power(x,&nbsp;n)&nbsp;</span><span style="color: #000000">&lt;&lt;</span><span style="color: #000000">&nbsp;endl;<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0</span><span style="color: #000000">;<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />__int64&nbsp;power(</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;x,&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">&nbsp;n)<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img id="Codehighlighter1_265_543_Open_Image" onclick="this.style.display='none'; Codehighlighter1_265_543_Open_Text.style.display='none'; Codehighlighter1_265_543_Closed_Image.style.display='inline'; Codehighlighter1_265_543_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_265_543_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_265_543_Closed_Text.style.display='none'; Codehighlighter1_265_543_Open_Image.style.display='inline'; Codehighlighter1_265_543_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_265_543_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_265_543_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(x&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">)<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img id="Codehighlighter1_287_311_Open_Image" onclick="this.style.display='none'; Codehighlighter1_287_311_Open_Text.style.display='none'; Codehighlighter1_287_311_Closed_Image.style.display='inline'; Codehighlighter1_287_311_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_287_311_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_287_311_Closed_Text.style.display='none'; Codehighlighter1_287_311_Open_Image.style.display='inline'; Codehighlighter1_287_311_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_287_311_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_287_311_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">22</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">;<br /></span><span style="color: #008080">23</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">24</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;(n&nbsp;</span><span style="color: #000000">==</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">)<br /></span><span style="color: #008080">25</span><span style="color: #000000"><img id="Codehighlighter1_333_357_Open_Image" onclick="this.style.display='none'; Codehighlighter1_333_357_Open_Text.style.display='none'; Codehighlighter1_333_357_Closed_Image.style.display='inline'; Codehighlighter1_333_357_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_333_357_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_333_357_Closed_Text.style.display='none'; Codehighlighter1_333_357_Open_Image.style.display='inline'; Codehighlighter1_333_357_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_333_357_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_333_357_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">26</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;x;<br /></span><span style="color: #008080">27</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">28</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">if</span><span style="color: #000000">&nbsp;((n&nbsp;</span><span style="color: #000000">&amp;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">0x00000001</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">)<br /></span><span style="color: #008080">29</span><span style="color: #000000"><img id="Codehighlighter1_394_452_Open_Image" onclick="this.style.display='none'; Codehighlighter1_394_452_Open_Text.style.display='none'; Codehighlighter1_394_452_Closed_Image.style.display='inline'; Codehighlighter1_394_452_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_394_452_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_394_452_Closed_Text.style.display='none'; Codehighlighter1_394_452_Open_Image.style.display='inline'; Codehighlighter1_394_452_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_394_452_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_394_452_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">30</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;power(x,&nbsp;n&nbsp;</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">)&nbsp;</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;power(x,&nbsp;n&nbsp;</span><span style="color: #000000">&gt;&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">);<br /></span><span style="color: #008080">31</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">32</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">else</span><span style="color: #000000"><br /></span><span style="color: #008080">33</span><span style="color: #000000"><img id="Codehighlighter1_467_541_Open_Image" onclick="this.style.display='none'; Codehighlighter1_467_541_Open_Text.style.display='none'; Codehighlighter1_467_541_Closed_Image.style.display='inline'; Codehighlighter1_467_541_Closed_Text.style.display='inline';" align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_467_541_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_467_541_Closed_Text.style.display='none'; Codehighlighter1_467_541_Open_Image.style.display='inline'; Codehighlighter1_467_541_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_467_541_Closed_Text"><img src="http://www.cppblog.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_467_541_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">34</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;power(x,&nbsp;(n&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">&gt;&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">)&nbsp;</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;power(x,&nbsp;(n&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">&gt;&gt;</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">1</span><span style="color: #000000">)&nbsp;</span><span style="color: #000000">*</span><span style="color: #000000">&nbsp;x;<br /></span><span style="color: #008080">35</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">36</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif"  alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">37</span><span style="color: #000000"><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /></span></div><img src ="http://www.cppblog.com/zhuxin/aggbug/193641.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zhuxin/" target="_blank">zhuxin</a> 2012-10-21 23:55 <a href="http://www.cppblog.com/zhuxin/articles/193641.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>