随笔分类 -  水题

摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159Common SubsequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18201Accepted Submission(s): 7697Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (pos 阅读全文
posted @ 2013-09-07 19:31 飞火扑蛾 阅读(187) 评论(0) 推荐(0)
摘要:题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1568分析:一道数学题找出斐波那契数列的通项公式,再利用对数的性质就可得到前几位的数斐波那契通项公式如下:取完对数后(记fn为第n个数)log10(fn)=-0.5*log10(5.0)+((double)n)*log(f)/log(10.0)+log10(1-((1-√5)/(1+√5))^n) 其中f=(sqrt(5.0)+1.0)/2.0;最后取对数的小数部分就可得最终结果代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 阅读全文
posted @ 2013-09-06 00:16 飞火扑蛾 阅读(187) 评论(0) 推荐(0)