Problem 25
Problem 25
- The Fibonacci sequence is defined by the recurrence relation:
- Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:- F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three digits.- What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
第一个包含1000位数的斐波那契数的索引是什么?
- fibonacci = []
- x, y = 1, 1
- index = 1
- while not len(str(x)) == 1000:
- index += 1
- fibonacci.append(x)
- x,y = y, x+y
- print(index)
Problem 25的更多相关文章
- codeforces水题100道 第十七题 Codeforces Beta Round #25 (Div. 2 Only) A. IQ test (brute force)
题目链接:http://www.codeforces.com/problemset/problem/25/A题意:在n个书中找到唯一一个奇偶性和其他n-1个数不同的数.C++代码: #include ...
- PAT_A1150#Travelling Salesman Problem
Source: PAT A1150 Travelling Salesman Problem (25 分) Description: The "travelling salesman prob ...
- Common Bugs in C Programming
There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...
- [MeetCoder] Count Pairs
Count Pairs Description You are given n circles centered on Y-aixs. The ith circle’s center is at po ...
- NOI.AC WC模拟赛
4C(容斥) http://noi.ac/contest/56/problem/25 同时交换一行或一列对答案显然没有影响,于是将行列均从大到小排序,每次处理限制相同的一段行列(呈一个L形). 问题变 ...
- 专题练习HDU题集 图论
[图论01]最短路 Start Time : 2018-01-02 12:45:00 End Time : 2018-01-23 12:45:00 Contest Status : Runnin ...
- PAT (Advanced Level) Practice(更新中)
Source: PAT (Advanced Level) Practice Reference: [1]胡凡,曾磊.算法笔记[M].机械工业出版社.2016.7 Outline: 基础数据结构: 线性 ...
- Hard模式题目
先过一下Hard模式的题目吧. # Title Editorial Acceptance Difficulty Frequency . 65 Valid Number 12.6% Ha ...
- 继续过Hard题目
接上一篇:http://www.cnblogs.com/charlesblc/p/6283064.html 继续过Hard模式的题目吧. # Title Editorial Acceptance ...
随机推荐
- AFNetworking的详细解析
AFNetworking serializer 分析 AFNetworkResponse.png 1. AFHTTPRequestOperationManager *manager = [AFHTTP ...
- Android---keycode值以及相应名称
KEYCODE列表 电话键 键名 描写叙述 键值 KEYCODE_CALL 拨号键 5 KEYCODE_ENDCALL 挂机键 6 KEYCODE_HOME 按键Home 3 KEYCODE_ME ...
- 南昌互联网行业协会筹办者祝真和华罡团队-2014年12月江西IDC排行榜
他出自军营,拥有一身正气. 他在南昌创业,立意卓越. 从站点開始.到微营销.到线上教育,全面开花. 他在朋友圈看到不对的内容,就会即时批评. 他对朋友,又是很的和蔼可亲. 他就是南昌华罡网络创办 ...
- 每日算法之二十六:Substring with Concatenation of All Words
变相的字符串匹配 给定一个字符串,然后再给定一组同样长度的单词列表,要求在字符串中查找满足下面条件的起始位置: 1)从这个位置開始包括单词列表中全部的单词.且每一个单词仅且必须出现一次. 2)在出现的 ...
- WPF学习笔记——ListBox用ItemsSource绑定数据源
作为一个WPF初学者,感到困难重重.在网上想查个ListBox绑定数据源的示例,结果出来一大堆代码,一看心就烦. 我给个简洁一点的代码: 后台代码: protected class UserItem ...
- 玩游戏(dfs)
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2566 #include <stdio.h ...
- NoSQL概念
NoSQL是非关系型数据库,即not only sql,key/value键值对存储. 现有Nosql DB产品:Redis/MongoDB/Memcached等等. SQL Sever是关系型数据库 ...
- WPF播放器
最近由于工作需要,需要做一个播放软件,在网上参考了很多例子,园子里有很多代码.其中最多的就是wpf自带的MediaElement控件,或者VLC视频播放器. 先附我自己查询资料的链接: MediaEm ...
- 关于17个Cr的430采购的注意事项 430F
430F不锈钢是在430钢上加上易切削性能的钢种.用于自动车床.螺栓和螺母等.430LX在430钢中添加Ti或Nb.降低C含量,改善了加工性能的和焊接性能.用于热水罐.供热水系统.卫生器具.家庭用耐用 ...
- 算法之dfs篇
dfs算法是深度搜索算法.从某一节点开始遍历直至到路径底部,如果不是所寻找的,则回溯到上个节点后,再遍历其他路径.不断重复这个过程.一般此过程消耗很大,需要一些优化才能保持算法的高效. hdu1010 ...