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的更多相关文章

  1. 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 ...

  2. PAT_A1150#Travelling Salesman Problem

    Source: PAT A1150 Travelling Salesman Problem (25 分) Description: The "travelling salesman prob ...

  3. Common Bugs in C Programming

    There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...

  4. [MeetCoder] Count Pairs

    Count Pairs Description You are given n circles centered on Y-aixs. The ith circle’s center is at po ...

  5. NOI.AC WC模拟赛

    4C(容斥) http://noi.ac/contest/56/problem/25 同时交换一行或一列对答案显然没有影响,于是将行列均从大到小排序,每次处理限制相同的一段行列(呈一个L形). 问题变 ...

  6. 专题练习HDU题集 图论

    [图论01]最短路 Start Time : 2018-01-02 12:45:00    End Time : 2018-01-23 12:45:00 Contest Status : Runnin ...

  7. PAT (Advanced Level) Practice(更新中)

    Source: PAT (Advanced Level) Practice Reference: [1]胡凡,曾磊.算法笔记[M].机械工业出版社.2016.7 Outline: 基础数据结构: 线性 ...

  8. Hard模式题目

    先过一下Hard模式的题目吧.   # Title Editorial Acceptance Difficulty Frequency   . 65 Valid Number     12.6% Ha ...

  9. 继续过Hard题目

    接上一篇:http://www.cnblogs.com/charlesblc/p/6283064.html 继续过Hard模式的题目吧.   # Title Editorial Acceptance ...

随机推荐

  1. linux sed 命令,sed -i

    -i 参数 :直接在原文件上进行操作整条语句意思是将b.c文件里第一个匹配printa替换为printb

  2. 2017 Multi-University Training Contest - Team 2&&hdu 6047 Maximum Sequence

    Maximum Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. bzoj 3231 [ Sdoi 2008 ] 递归数列 —— 矩阵乘法

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3231 裸矩阵乘法. 代码如下: #include<iostream> #incl ...

  4. 一个豆瓣 API 的反向代理配置,旨在解决豆瓣屏蔽小程序请求问题(豆瓣接口 403 问题)

    #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #erro ...

  5. PCB 内网实现《OCR文字识别》实现逻辑

    一.实现内网信息获取网络图 二. OCR文字识别,运用技术点(啰嗦了,即然写了就都写了一遍) 三. C#客户端实现界面, 设置界面描述功能待完善,

  6. Python 41 完整查询语句 和 一堆关键字

    一:完整查询语句 1.拷贝表 *** create table copy_table select *from customer ; 拷贝结构 与数据 create table copy_table ...

  7. go的常量与变量

    一.常量 1.1 定义 常量使用关键字const 定义,用于存储不会变化的数据 定义方法 const identifier [type] = value package main // 常量定义 co ...

  8. 可变长度参数列表(Stering...aaa)

  9. SQLServer 在存储过程里使用事务控制的简单小例子

    alter proc sp_test(     @name varchar(50))asbegin    --开始事务   begin transaction   --设置一个存储报错代码的变量   ...

  10. Android自定义开机和关机动画

    Android自定义开机和关机动画 Android在开机的过程中,会经历三张图片,关于静态图的修改在我的这篇文章中有介绍到: Android开机图片替换 现在要介绍的是怎么用动画替换静态图片.开/关机 ...