﻿<?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/14460.html</link><description>                             ______________白白の屋</description><language>zh-cn</language><lastBuildDate>Fri, 22 Oct 2010 15:26:30 GMT</lastBuildDate><pubDate>Fri, 22 Oct 2010 15:26:30 GMT</pubDate><ttl>60</ttl><item><title>HDU 1250 HDOJ 1250 Hat's Fibonacci ACM 1250 IN HDU</title><link>http://www.cppblog.com/MiYu/archive/2010/10/22/130924.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Fri, 22 Oct 2010 12:41:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/10/22/130924.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/130924.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/10/22/130924.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/130924.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/130924.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://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; 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; ">&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; "><span class="Apple-tab-span" style="white-space: pre; ">	</span><a href="http://acm.hdu.edu.cn/showproblem.php?pid=1250">http://acm.hdu.edu.cn/showproblem.php?pid=1250</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"><span  style="font-family: 'Times New Roman'; color: rgb(0, 0, 0); line-height: normal; font-size: medium; "><h1 style="color: rgb(26, 92, 200); text-align: center; ">Hat's Fibonacci</h1><font><strong><span style="font-family: Arial; font-size: 12px; font-weight: bold; color: green; ">Time Limit: 2000/1000 MS (Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory Limit: 65536/32768 K (Java/Others)<br>Total Submission(s): 2208&nbsp;&nbsp;&nbsp;&nbsp;Accepted Submission(s): 684<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; 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; background-repeat: no-repeat repeat; ">A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.<br>F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n&gt;4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4)<br>Your task is to take a number as input, and print that Fibonacci number.<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; 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; 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; background-repeat: no-repeat repeat; ">Each line will contain an integers. Process to end of file.<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; 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; 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; background-repeat: no-repeat repeat; ">For each case, output the result in a line.</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; 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; 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; 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; ">100</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; 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; 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; 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; ">4203968145672990846840663646


Note:
No generated Fibonacci number in excess of 2005 digits will be in the test data, ie. F(20) = 66526 has 5 digits.</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; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">&nbsp;</div><div><br></div><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></span></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; ">Mail to &nbsp; : miyubai@gamil.com</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; ">MyBlog &nbsp; &nbsp;: baiyun.me</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; ">Complier &nbsp;: g++ mingw32-3.4.2</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; : Hat's Fibonacci</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; ">Doc Name &nbsp;: HDU_1250</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; "><br></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; "><br></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; "><br></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; ">高精度的水题 , JAVA &nbsp;水过, 当然 用模板也一样&nbsp;</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; "><br></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; "><br></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; ">package 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; ">import java.util.*;</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; ">import java.math.*;</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; ">import java.io.*;</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; ">public class 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;public static void main(String[] args) {</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;Scanner cin = new Scanner ( System.in );</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;while ( cin.hasNext() ) {</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;int N = cin.nextInt();</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;if ( N &lt;= 4 ) {</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;System.out.println ( 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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</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;BigInteger one = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BigInteger two = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BigInteger three = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BigInteger four = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BigInteger res = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BigInteger temp = new BigInteger ( "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; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for ( int i = 4; i &lt; N; ++ i ) {</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; &nbsp; &nbsp;res = one.add(two).add(three).add(four);</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; &nbsp; &nbsp;temp = res;</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; &nbsp; &nbsp;one= two;</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; &nbsp; &nbsp;two = three;</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; &nbsp; &nbsp;three = four;</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; &nbsp; &nbsp;four = temp;</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;}</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;System.out.println( res );</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;}</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;}</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;}</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; "><br></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; "><span class="Apple-tab-span" style="white-space: pre; ">	</span>&nbsp;</p>
<img src ="http://www.cppblog.com/MiYu/aggbug/130924.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-22 20:41 <a href="http://www.cppblog.com/MiYu/archive/2010/10/22/130924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ 1063 HDU 1063 Exponentiation JAVA 编写 ACM 1063 IN HDU</title><link>http://www.cppblog.com/MiYu/archive/2010/09/10/126325.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Fri, 10 Sep 2010 09:01:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/09/10/126325.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/126325.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/09/10/126325.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/126325.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/126325.html</trackback:ping><description><![CDATA[<p><span style="font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; line-height: normal; font-size: 13px;">MiYu原创, 转帖请注明 : 转载自&nbsp;<font color="#1d58d1"><a  href="http://www.cnblogs.com/MiYu" style="text-decoration: none; color: #1d58d1;">______________白白の屋</a>&nbsp;&nbsp;<img  src="http://www.cnblogs.com/Emoticons/baimantou/223332482.gif" alt="">&nbsp;&nbsp;</font></span></p>
<p>&nbsp;</p>
<p>题目地址:&nbsp; <a  href="http://acm.hdu.edu.cn/showproblem.php?pid=1063">http://acm.hdu.edu.cn/showproblem.php?pid=1063</a><br></p>
<p>题目描述:<br></p>
<div class="cnblogs_code">
<div><span style="color: #800080;">
<h1>Exponentiation</h1>
<strong><span style="font-family: Arial; font-size: 12px; font-weight: bold; color: green;">Time Limit: 1000/500 MS (Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory Limit: 65536/32768 K (Java/Others)<br>Total Submission(s): 1696&nbsp;&nbsp;&nbsp;&nbsp;Accepted Submission(s): 376<br></span></strong><br><br>
<div align="left">Problem Description</div>
<div>Problems
involving the computation of exact values of very large magnitude and
precision are common. For example, the computation of the national debt
is a taxing experience for many computer systems. <br><br>This problem requires that you write a program to compute the exact value of R<sup>n</sup> where R is a real number ( 0.0 &lt; R &lt; 99.999 ) and n is an integer such that 0 &lt; n &lt;= 25. <br></div>
<div>&nbsp;</div>
<br>
<div align="left">Input</div>
<div>The
input will consist of a set of pairs of values for R and n. The R
value  will occupy columns 1 through 6, and the n value will be in
columns 8  and 9.<br></div>
<div>&nbsp;</div>
<br>
<div align="left">Output</div>
<div>The
output will consist of one line for each line of input giving the
exact  value of R^n. Leading zeros should be suppressed in the output.
Insignificant trailing zeros must not be printed. Don't print the
decimal point if the result is an integer.<br></div>
<div>&nbsp;</div>
<br>
<div align="left">Sample Input</div>
<div>
<pre>
<div style="font-family: Courier New,Courier,monospace;">95.123 12 0.4321 20 5.1234 15 6.7592  9 98.999 10 1.0100 12</div>
</pre>
</div>
<div>&nbsp;</div>
<br>
<div align="left">Sample Output</div>
<div>
<pre>
<div style="font-family: Courier New,Courier,monospace;">548815620517731830194541.899025343415715973535967221869852721 .00000005148554641076956121994511276767154838481760200726351203835429763013462401 43992025569.928573701266488041146654993318703707511666295476720493953024 29448126.764121021618164430206909037173276672 90429072743629540498.107596019456651774561044010001 1.126825030131969720661201</div>
</pre>
</div>
<div>&nbsp;</div>
<p>这两天突然想学习下JAVA 的大数&nbsp; 就学习了一下, 这道题在PKU A掉了的, 不过在 HDU 一直没过, 不知道有什么恶心的数据把我给恶心掉了, 很郁闷.</p>
<p>不过 用JAVA直接 1 A 了........... 很简单的说</p>
<p>&nbsp;</p>
<p>代码如下 :</p>
<p>&nbsp;</p>
<p>/*<br>&nbsp;* To change this template, choose Tools | Templates<br>&nbsp;* and open the template in the editor.<br>&nbsp;*/<br>import java.util.Scanner;<br>import java.math.*;<br><br>/**<br>&nbsp;*<br>&nbsp;* @author baiyun<br>&nbsp;*/<br>public class Main {<br><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param args the command line arguments<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Scanner in = new Scanner ( System.in );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BigDecimal num;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int exp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while ( in.hasNext() ){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; num = in.nextBigDecimal();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp = in.nextInt();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; num = num.pow ( exp );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; num = num.stripTrailingZeros();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String out = num.toPlainString();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( out.charAt(0) == '0' )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out = out.substring(1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println( out );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>&nbsp;</p>
</span></div>
</div>
<p><br></p>
<p>&nbsp;</p><img src ="http://www.cppblog.com/MiYu/aggbug/126325.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-10 17:01 <a href="http://www.cppblog.com/MiYu/archive/2010/09/10/126325.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ HDU 1715 大菲波数 ACM 1715 IN HDU </title><link>http://www.cppblog.com/MiYu/archive/2010/08/08/122709.html</link><dc:creator>MiYu</dc:creator><author>MiYu</author><pubDate>Sun, 08 Aug 2010 14:38:00 GMT</pubDate><guid>http://www.cppblog.com/MiYu/archive/2010/08/08/122709.html</guid><wfw:comment>http://www.cppblog.com/MiYu/comments/122709.html</wfw:comment><comments>http://www.cppblog.com/MiYu/archive/2010/08/08/122709.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/MiYu/comments/commentRss/122709.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/MiYu/services/trackbacks/122709.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=1715">http://acm.hdu.edu.cn/showproblem.php?pid=1715</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>Fibonacci数列，定义如下：<br>f(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">f(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br>f(n)</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">f(n</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">f(n</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)&nbsp;n</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">。<br>计算第n项Fibonacci数值。<br>&nbsp;<br><br>Input<br>输入第一行为一个整数N，接下来N行为整数Pi（</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">Pi</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">）。<br>&nbsp;<br><br>Output<br>输出为N行，每行为对应的f(Pi)。<br>&nbsp;<br><br>Sample&nbsp;Input<br></span><span style="COLOR: #000000">5</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">4</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">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">2</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000"><br></span><span style="COLOR: #000000">5</span><span style="COLOR: #000000"><br></span></div>
<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: 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>#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></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><br></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;Add(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;fNum,</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;sNum)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(&nbsp;fNum.length()&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;sNum.length()&nbsp;)&nbsp;fNum.swap(sNum);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;A&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;A&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;fNum;<br>&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</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">fNum.length();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">if</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">sNum.length())<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;A[A.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">i]</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">sNum[sNum.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">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;</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</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">A.length();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;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(A[A.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">i]</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">9</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;A[A.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">i]</span><span style="COLOR: #000000">-=</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">;A[A.length()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">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">1</span><span style="COLOR: #000000">;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(A[</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">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)&nbsp;A.erase(</span><span style="COLOR: #000000">0</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;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;A;<br>}<br><br></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&nbsp;F[</span><span style="COLOR: #000000">1001</span><span style="COLOR: #000000">]&nbsp;</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;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">1</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;};<br></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;setNum&nbsp;()<br>{<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">3</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1001</span><span style="COLOR: #000000">;&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;F[i]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Add&nbsp;(&nbsp;F[i</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]&nbsp;,&nbsp;F[i</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">]&nbsp;)&nbsp;;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;<br>}<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;setNum&nbsp;();<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;)<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;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;N;<br>&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;N;<br>&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;F[N]&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;}<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>
</span>
<img src ="http://www.cppblog.com/MiYu/aggbug/122709.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:38 <a href="http://www.cppblog.com/MiYu/archive/2010/08/08/122709.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>