﻿<?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++博客-acronix-随笔分类-zhaoboqiang解题报告</title><link>http://www.cppblog.com/acronix/category/14697.html</link><description /><language>zh-cn</language><lastBuildDate>Mon, 13 Sep 2010 03:42:23 GMT</lastBuildDate><pubDate>Mon, 13 Sep 2010 03:42:23 GMT</pubDate><ttl>60</ttl><item><title>harbin网络预选赛1003</title><link>http://www.cppblog.com/acronix/archive/2010/09/11/126413.html</link><dc:creator>acronix</dc:creator><author>acronix</author><pubDate>Sat, 11 Sep 2010 09:33:00 GMT</pubDate><guid>http://www.cppblog.com/acronix/archive/2010/09/11/126413.html</guid><wfw:comment>http://www.cppblog.com/acronix/comments/126413.html</wfw:comment><comments>http://www.cppblog.com/acronix/archive/2010/09/11/126413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acronix/comments/commentRss/126413.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acronix/services/trackbacks/126413.html</trackback:ping><description><![CDATA[<p>用Java二分开方</p>
<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"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">import&nbsp;java.util.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">import&nbsp;java.math.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img id=Codehighlighter1_59_1008_Open_Image onclick="this.style.display='none'; Codehighlighter1_59_1008_Open_Text.style.display='none'; Codehighlighter1_59_1008_Closed_Image.style.display='inline'; Codehighlighter1_59_1008_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_59_1008_Closed_Image onclick="this.style.display='none'; Codehighlighter1_59_1008_Closed_Text.style.display='none'; Codehighlighter1_59_1008_Open_Image.style.display='inline'; Codehighlighter1_59_1008_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Main&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_59_1008_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_59_1008_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_100_1006_Open_Image onclick="this.style.display='none'; Codehighlighter1_100_1006_Open_Text.style.display='none'; Codehighlighter1_100_1006_Closed_Image.style.display='inline'; Codehighlighter1_100_1006_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_100_1006_Closed_Image onclick="this.style.display='none'; Codehighlighter1_100_1006_Closed_Text.style.display='none'; Codehighlighter1_100_1006_Open_Image.style.display='inline'; Codehighlighter1_100_1006_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;main(String[]&nbsp;args)</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_100_1006_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_100_1006_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;Scanner&nbsp;cin&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;Scanner(System.</span><span style="COLOR: #0000ff">in</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;BigInteger&nbsp;y&nbsp;;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;s;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">cin.next();<br><img id=Codehighlighter1_210_1003_Open_Image onclick="this.style.display='none'; Codehighlighter1_210_1003_Open_Text.style.display='none'; Codehighlighter1_210_1003_Closed_Image.style.display='inline'; Codehighlighter1_210_1003_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_210_1003_Closed_Image onclick="this.style.display='none'; Codehighlighter1_210_1003_Closed_Text.style.display='none'; Codehighlighter1_210_1003_Open_Image.style.display='inline'; Codehighlighter1_210_1003_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="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">s.equals(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">#</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))</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_210_1003_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_210_1003_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_232_296_Open_Image onclick="this.style.display='none'; Codehighlighter1_232_296_Open_Text.style.display='none'; Codehighlighter1_232_296_Closed_Image.style.display='inline'; Codehighlighter1_232_296_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_232_296_Closed_Image onclick="this.style.display='none'; Codehighlighter1_232_296_Closed_Text.style.display='none'; Codehighlighter1_232_296_Open_Image.style.display='inline'; Codehighlighter1_232_296_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="COLOR: #0000ff">if</span><span style="COLOR: #000000">(s.equals(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))</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_232_296_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_232_296_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;System.</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.println(</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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">cin.next();<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">continue</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;}</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;y</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;BigInteger(s);<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;BigInteger&nbsp;max&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;y;<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;BigInteger&nbsp;min&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;BigInteger.ONE;&nbsp;<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;BigInteger&nbsp;two&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;BigInteger(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);&nbsp;<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;BigInteger&nbsp;avg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;BigInteger.ZERO;&nbsp;<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;BigInteger&nbsp;lastAvg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;&nbsp;<br><img id=Codehighlighter1_524_703_Open_Image onclick="this.style.display='none'; Codehighlighter1_524_703_Open_Text.style.display='none'; Codehighlighter1_524_703_Closed_Image.style.display='inline'; Codehighlighter1_524_703_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_524_703_Closed_Image onclick="this.style.display='none'; Codehighlighter1_524_703_Closed_Text.style.display='none'; Codehighlighter1_524_703_Open_Image.style.display='inline'; Codehighlighter1_524_703_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="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">avg.equals(lastAvg))&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_524_703_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_524_703_Open_Text><span style="COLOR: #000000">{&nbsp;<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;lastAvg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;avg;&nbsp;avg&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;max.add(min).divide(two);&nbsp;<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">int</span><span style="COLOR: #000000">&nbsp;res&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;avg.multiply(avg).compareTo(y);&nbsp;<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">(res&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;&nbsp;<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">(res&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;max&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;avg;&nbsp;<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">else</span><span style="COLOR: #000000">&nbsp;min&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;avg;&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">&nbsp;<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">int</span><span style="COLOR: #000000">&nbsp;a[]</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[</span><span style="COLOR: #000000">10010</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">int</span><span style="COLOR: #000000">&nbsp;pt</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img id=Codehighlighter1_784_895_Open_Image onclick="this.style.display='none'; Codehighlighter1_784_895_Open_Text.style.display='none'; Codehighlighter1_784_895_Closed_Image.style.display='inline'; Codehighlighter1_784_895_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_784_895_Closed_Image onclick="this.style.display='none'; Codehighlighter1_784_895_Closed_Text.style.display='none'; Codehighlighter1_784_895_Open_Image.style.display='inline'; Codehighlighter1_784_895_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="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">avg.equals(BigInteger.ZERO))</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_784_895_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_784_895_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;a[pt]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">avg.mod(BigInteger.valueOf(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)).intValue();<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;avg</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">avg.divide(BigInteger.valueOf(</span><span style="COLOR: #000000">2</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;pt</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;}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_924_957_Open_Image onclick="this.style.display='none'; Codehighlighter1_924_957_Open_Text.style.display='none'; Codehighlighter1_924_957_Closed_Image.style.display='inline'; Codehighlighter1_924_957_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_924_957_Closed_Image onclick="this.style.display='none'; Codehighlighter1_924_957_Closed_Text.style.display='none'; Codehighlighter1_924_957_Open_Image.style.display='inline'; Codehighlighter1_924_957_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="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">pt</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)</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_924_957_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_924_957_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;System.</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.print(a[i]);<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;System.</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.println();<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;s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">cin.next();<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/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/acronix/aggbug/126413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acronix/" target="_blank">acronix</a> 2010-09-11 17:33 <a href="http://www.cppblog.com/acronix/archive/2010/09/11/126413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hdu_3607(dp+离散化+线段树)</title><link>http://www.cppblog.com/acronix/archive/2010/09/08/126137.html</link><dc:creator>acronix</dc:creator><author>acronix</author><pubDate>Wed, 08 Sep 2010 00:57:00 GMT</pubDate><guid>http://www.cppblog.com/acronix/archive/2010/09/08/126137.html</guid><wfw:comment>http://www.cppblog.com/acronix/comments/126137.html</wfw:comment><comments>http://www.cppblog.com/acronix/archive/2010/09/08/126137.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acronix/comments/commentRss/126137.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acronix/services/trackbacks/126137.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;首先将箱子的高度进行离散化处理，然后根据箱子的高度建树，dp[i]=max(dp[j])+gi(1&lt;=j&lt;i且hi&gt;hj)，通过线段树查找小于hi的dp[j]最大值,即查找1到hi-1之间的最大值。结果是dp[i]的最大值。线段树应用还是很神奇的o(&#8745;_&#8745;)o #include&l...&nbsp;&nbsp;<a href='http://www.cppblog.com/acronix/archive/2010/09/08/126137.html'>阅读全文</a><img src ="http://www.cppblog.com/acronix/aggbug/126137.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acronix/" target="_blank">acronix</a> 2010-09-08 08:57 <a href="http://www.cppblog.com/acronix/archive/2010/09/08/126137.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>poj 2528 线段树</title><link>http://www.cppblog.com/acronix/archive/2010/08/23/124442.html</link><dc:creator>acronix</dc:creator><author>acronix</author><pubDate>Mon, 23 Aug 2010 09:23:00 GMT</pubDate><guid>http://www.cppblog.com/acronix/archive/2010/08/23/124442.html</guid><wfw:comment>http://www.cppblog.com/acronix/comments/124442.html</wfw:comment><comments>http://www.cppblog.com/acronix/archive/2010/08/23/124442.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acronix/comments/commentRss/124442.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acronix/services/trackbacks/124442.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Mayor's postersDescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. ...&nbsp;&nbsp;<a href='http://www.cppblog.com/acronix/archive/2010/08/23/124442.html'>阅读全文</a><img src ="http://www.cppblog.com/acronix/aggbug/124442.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acronix/" target="_blank">acronix</a> 2010-08-23 17:23 <a href="http://www.cppblog.com/acronix/archive/2010/08/23/124442.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hdu 3546</title><link>http://www.cppblog.com/acronix/archive/2010/08/22/124329.html</link><dc:creator>acronix</dc:creator><author>acronix</author><pubDate>Sun, 22 Aug 2010 14:52:00 GMT</pubDate><guid>http://www.cppblog.com/acronix/archive/2010/08/22/124329.html</guid><wfw:comment>http://www.cppblog.com/acronix/comments/124329.html</wfw:comment><comments>http://www.cppblog.com/acronix/archive/2010/08/22/124329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acronix/comments/commentRss/124329.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acronix/services/trackbacks/124329.html</trackback:ping><description><![CDATA[&nbsp;
<p><strong><span>Calculator</span></strong></p>
<p><strong><span>Time Limit: 2000/2000 MS (Java/Others)<span>&nbsp;&nbsp;&nbsp; </span>Memory Limit: 65535/32768 K (Java/Others)</span></strong></p>
<p><strong><span>Total Submission(s): 369<span>&nbsp;&nbsp;&nbsp; </span>Accepted Submission(s): 119</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong><span>Problem Description</span></strong></p>
<p><strong><span>Golden Adobe is the most advanced computer for scientific computing in the world. Unfortunately, it broke down. Your task is to write a super computing software to take its place. The software contains 10 registers named from A to J. There are three operations on the registers:</span></strong></p>
<p><strong><span>1) Assignment: X=Y</span></strong></p>
<p><strong><span>2) Addition: X+=Y</span></strong></p>
<p><strong><span>3) Multiplication: X*=Y</span></strong></p>
<p><strong><span>Notice that X and Y are two registers, and they may be the same. </span></strong></p>
<p><strong><span>Initially, all the registers are stored by integer 1. Your program should operate several operations and output the final result for 10 registers. You may assume that the length of each decimal number stored in the register is no longer than 5000.</span></strong></p>
<p><strong><span>&nbsp;</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong><span>Input</span></strong></p>
<p><strong><span>The input contains only one test case including several lines.</span></strong></p>
<p><strong><span>Each line contains an operation to be calculated.</span></strong></p>
<p><strong><span>The number of operations will no more than 300000.</span></strong></p>
<p><strong><span>&nbsp;</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong><span>Output</span></strong></p>
<p><strong><span>The output should contains exactly 10 lines, each line contains an integer denoting the decimal number in the register. See sample test case for further details.</span></strong></p>
<p><strong><span>&nbsp;</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong><span>Sample Input</span></strong></p>
<p><strong><span>A+=B</span></strong></p>
<p><strong><span>A*=A</span></strong></p>
<p><strong><span>A+=A</span></strong></p>
<p><strong><span>B+=A</span></strong></p>
<p><strong><span>C+=B</span></strong></p>
<p><strong><span>D=B</span></strong><strong></strong></p>
<p><strong><span>&nbsp;</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><strong><span>Sample Output</span></strong></p>
<p><strong><span>8</span></strong></p>
<p><strong><span>9</span></strong></p>
<p><strong><span>10</span></strong></p>
<p><strong><span>9</span></strong></p>
<p><strong><span>1</span></strong></p>
<p><strong><span>1</span></strong></p>
<p><strong><span>1</span></strong></p>
<p><strong><span>1</span></strong></p>
<p><strong><span>1</span></strong></p>
<p><strong><span>1<br><br><span style="COLOR: red">读入注意要用Scanner中的next()方法，用nextline()就TLE</span><br><br></span></strong></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">import&nbsp;java.math.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>import&nbsp;java.util.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img id=Codehighlighter1_59_706_Open_Image onclick="this.style.display='none'; Codehighlighter1_59_706_Open_Text.style.display='none'; Codehighlighter1_59_706_Closed_Image.style.display='inline'; Codehighlighter1_59_706_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_59_706_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_59_706_Closed_Text.style.display='none'; Codehighlighter1_59_706_Open_Image.style.display='inline'; Codehighlighter1_59_706_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Main&nbsp;</span><span id=Codehighlighter1_59_706_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_59_706_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;BigInteger[]&nbsp;num&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;BigInteger[</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">];;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_157_704_Open_Image onclick="this.style.display='none'; Codehighlighter1_157_704_Open_Text.style.display='none'; Codehighlighter1_157_704_Closed_Image.style.display='inline'; Codehighlighter1_157_704_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_157_704_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_157_704_Closed_Text.style.display='none'; Codehighlighter1_157_704_Open_Image.style.display='inline'; Codehighlighter1_157_704_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;main(String[]&nbsp;args)&nbsp;</span><span id=Codehighlighter1_157_704_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_157_704_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scanner&nbsp;cin&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;Scanner(System.</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">);<br><img id=Codehighlighter1_230_262_Open_Image onclick="this.style.display='none'; Codehighlighter1_230_262_Open_Text.style.display='none'; Codehighlighter1_230_262_Closed_Image.style.display='inline'; Codehighlighter1_230_262_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_230_262_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_230_262_Closed_Text.style.display='none'; Codehighlighter1_230_262_Open_Image.style.display='inline'; Codehighlighter1_230_262_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&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">&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_230_262_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_230_262_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num[i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;BigInteger.ONE;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_288_632_Open_Image onclick="this.style.display='none'; Codehighlighter1_288_632_Open_Text.style.display='none'; Codehighlighter1_288_632_Closed_Image.style.display='inline'; Codehighlighter1_288_632_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_288_632_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_288_632_Closed_Text.style.display='none'; Codehighlighter1_288_632_Open_Image.style.display='inline'; Codehighlighter1_288_632_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(cin.hasNext())&nbsp;</span><span id=Codehighlighter1_288_632_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_288_632_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;s&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cin.next();<br><img id=Codehighlighter1_340_563_Open_Image onclick="this.style.display='none'; Codehighlighter1_340_563_Open_Text.style.display='none'; Codehighlighter1_340_563_Closed_Image.style.display='inline'; Codehighlighter1_340_563_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_340_563_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_340_563_Closed_Text.style.display='none'; Codehighlighter1_340_563_Open_Image.style.display='inline'; Codehighlighter1_340_563_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(s.length()&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 id=Codehighlighter1_340_563_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_340_563_Open_Text><span style="COLOR: #000000">{<br><img id=Codehighlighter1_370_463_Open_Image onclick="this.style.display='none'; Codehighlighter1_370_463_Open_Text.style.display='none'; Codehighlighter1_370_463_Closed_Image.style.display='inline'; Codehighlighter1_370_463_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_370_463_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_370_463_Closed_Text.style.display='none'; Codehighlighter1_370_463_Open_Image.style.display='inline'; Codehighlighter1_370_463_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&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;(s.charAt(</span><span style="COLOR: #000000">1</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">*</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_370_463_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_370_463_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num[s.charAt(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num[s.charAt(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">].multiply(num[s.charAt(</span><span style="COLOR: #000000">3</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">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]);<br><img id=Codehighlighter1_470_558_Open_Image onclick="this.style.display='none'; Codehighlighter1_470_558_Open_Text.style.display='none'; Codehighlighter1_470_558_Closed_Image.style.display='inline'; Codehighlighter1_470_558_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_470_558_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_470_558_Closed_Text.style.display='none'; Codehighlighter1_470_558_Open_Image.style.display='inline'; Codehighlighter1_470_558_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span id=Codehighlighter1_470_558_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_470_558_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num[s.charAt(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num[s.charAt(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">].add(num[s.charAt(</span><span style="COLOR: #000000">3</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">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_570_628_Open_Image onclick="this.style.display='none'; Codehighlighter1_570_628_Open_Text.style.display='none'; Codehighlighter1_570_628_Closed_Image.style.display='inline'; Codehighlighter1_570_628_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_570_628_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_570_628_Closed_Text.style.display='none'; Codehighlighter1_570_628_Open_Image.style.display='inline'; Codehighlighter1_570_628_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span id=Codehighlighter1_570_628_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_570_628_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num[s.charAt(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num[s.charAt(</span><span style="COLOR: #000000">2</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">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_666_701_Open_Image onclick="this.style.display='none'; Codehighlighter1_666_701_Open_Text.style.display='none'; Codehighlighter1_666_701_Closed_Image.style.display='inline'; Codehighlighter1_666_701_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_666_701_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_666_701_Closed_Text.style.display='none'; Codehighlighter1_666_701_Open_Image.style.display='inline'; Codehighlighter1_666_701_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&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">&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_666_701_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_666_701_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.println(num[i]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<img src ="http://www.cppblog.com/acronix/aggbug/124329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acronix/" target="_blank">acronix</a> 2010-08-22 22:52 <a href="http://www.cppblog.com/acronix/archive/2010/08/22/124329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hdu 1042 （N！）Java高精度</title><link>http://www.cppblog.com/acronix/archive/2010/08/22/124319.html</link><dc:creator>acronix</dc:creator><author>acronix</author><pubDate>Sun, 22 Aug 2010 13:21:00 GMT</pubDate><guid>http://www.cppblog.com/acronix/archive/2010/08/22/124319.html</guid><wfw:comment>http://www.cppblog.com/acronix/comments/124319.html</wfw:comment><comments>http://www.cppblog.com/acronix/archive/2010/08/22/124319.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/acronix/comments/commentRss/124319.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/acronix/services/trackbacks/124319.html</trackback:ping><description><![CDATA[&nbsp;
<p align=center><strong><span>N!</span></strong></p>
<p align=center><strong><span>Time Limit: 10000/5000 MS (Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory Limit: 65536/32768 K (Java/Others)<br>Total Submission(s): 17754&nbsp;&nbsp;&nbsp;&nbsp;Accepted Submission(s): 4605<br><br></span></strong></p>
<p align=left><strong><span>Problem Description</span></strong></p>
<p align=left><span>Given an integer N(0 &#8804; N &#8804; 10000), your task is to calculate N!</span></p>
<p align=center>&nbsp;</p>
<p align=center>&nbsp;</p>
<p align=left><strong><span>Input</span></strong></p>
<p align=left><span>One N in one line, process to the end of file.</span></p>
<p align=center>&nbsp;</p>
<p align=center>&nbsp;</p>
<p align=left><strong><span>Output</span></strong></p>
<p align=left><span>For each N, output N! in one line.</span></p>
<p align=center>&nbsp;</p>
<p align=center>&nbsp;</p>
<p align=left><strong><span>Sample Input</span></strong></p>
<p align=left><span>1</span></p>
<p align=left><span>2</span></p>
<p align=left><span>3</span></p>
<p align=center>&nbsp;</p>
<p align=center>&nbsp;</p>
<p align=left><strong><span>Sample Output</span></strong></p>
<p align=left><span>1</span></p>
<p align=left><span>2</span></p>
<p align=left><span>6</span></p>
<br>Java解高精度的题目还是很爽的，注意类名要写成Main，<a href="http://acm.hdu.edu.cn/viewerror.php?rid=2858503" target=_blank><font color=#6633ff>Compilation Error</font></a>了n次。<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">import&nbsp;java.math.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>import&nbsp;java.util.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img id=Codehighlighter1_59_400_Open_Image onclick="this.style.display='none'; Codehighlighter1_59_400_Open_Text.style.display='none'; Codehighlighter1_59_400_Closed_Image.style.display='inline'; Codehighlighter1_59_400_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_59_400_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_59_400_Closed_Text.style.display='none'; Codehighlighter1_59_400_Open_Image.style.display='inline'; Codehighlighter1_59_400_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Main&nbsp;</span><span id=Codehighlighter1_59_400_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_59_400_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;BigInteger&nbsp;num;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img id=Codehighlighter1_133_398_Open_Image onclick="this.style.display='none'; Codehighlighter1_133_398_Open_Text.style.display='none'; Codehighlighter1_133_398_Closed_Image.style.display='inline'; Codehighlighter1_133_398_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_133_398_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_133_398_Closed_Text.style.display='none'; Codehighlighter1_133_398_Open_Image.style.display='inline'; Codehighlighter1_133_398_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;main(String&nbsp;args[])&nbsp;</span><span id=Codehighlighter1_133_398_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_133_398_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scanner&nbsp;cin&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;Scanner(System.</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img id=Codehighlighter1_202_395_Open_Image onclick="this.style.display='none'; Codehighlighter1_202_395_Open_Text.style.display='none'; Codehighlighter1_202_395_Closed_Image.style.display='inline'; Codehighlighter1_202_395_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_202_395_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_202_395_Closed_Text.style.display='none'; Codehighlighter1_202_395_Open_Image.style.display='inline'; Codehighlighter1_202_395_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(cin.hasNext())&nbsp;</span><span id=Codehighlighter1_202_395_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_202_395_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&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;BigInteger.ONE;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;cin.nextInt();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&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;BigInteger.ONE;<br><img id=Codehighlighter1_312_363_Open_Image onclick="this.style.display='none'; Codehighlighter1_312_363_Open_Text.style.display='none'; Codehighlighter1_312_363_Closed_Image.style.display='inline'; Codehighlighter1_312_363_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_312_363_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_312_363_Closed_Text.style.display='none'; Codehighlighter1_312_363_Open_Image.style.display='inline'; Codehighlighter1_312_363_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&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;n;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span id=Codehighlighter1_312_363_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_312_363_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;num.multiply(BigInteger.valueOf(i));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">.println(num);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
<img src ="http://www.cppblog.com/acronix/aggbug/124319.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/acronix/" target="_blank">acronix</a> 2010-08-22 21:21 <a href="http://www.cppblog.com/acronix/archive/2010/08/22/124319.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>