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 ...
随机推荐
- 開始学习hadoop
思前想后,还是准备自学hadoop,作为一个初级的linux学员,更不懂什么是云.hadoop仅仅知道是个框架和基础平台,详细什么玩意也得慢慢学习了解,但还是明确他的重要性.公司近期也在内部招聘这方面 ...
- Yum重装走过的坑
今天因为用yum方式安装mongo遇到报错,从而我选择卸载yum并重新安装. 我先选择了用rpm方式进行重装,从163的packages列表里面找到64位redhat6.5可以用的三个rpm包,安装过 ...
- axis实现webservices分布式通信
分布式通信原理 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2ZsMjAxMjEzMTQ=/font/5a6L5L2T/fontsize/400/fil ...
- xpath元素查找提示is not clickable
1.用xpath可以在chrome找到 $x("//mandatory-config-dialog[@is-show='isShowMandatoryConfig']/div/div[2]/ ...
- 民意调查Django实现(三)
我们接着第二小节的開始继续我们的旅程. 我们会继续Web-poll应用.而且将会专注于创建公共接口 - "Views". 哲学思想 一个视图是你的Django应用中的一个Web页面 ...
- 配置Java连接池的两种方式:tomcat方式以及spring方式
1. tomcat方式:在context.xml配置连接池,然后在web.xml中写配置代码(也能够在server.xml文件里配置连接池).这两种方法的差别是:在tomcat6版本号及以上中cont ...
- Codeforces--596A--Wilbur and Swimming Pool(数学)
A - Wilbur and Swimming Pool Crawling in process... Crawling failed Time Limit:1000MS Memory ...
- C++_homework_StackSort
顾名思义(?)类似于单调栈?维护一个单调递减的栈.一旦准备入栈的元素大于栈顶元素,栈一直弹出直到准备入栈的元素小于等于栈顶元素,弹出的元素压入另一个tmp栈中. #include <iostre ...
- 逻辑回归 C++
#include <iostream>#include <string>#include <fstream>#include <sstream>#inc ...
- 86. Ext文本输入框:Ext.form.TextField属性汇总
转自:https://blog.csdn.net/ryuudenne/article/details/8834650 Ext.form.TextField主要配置表: allowBlank ...