原题地址

竟然64位都要爆,这是要大整数乘法的节奏吗?我才不要写大整数乘法呢,用Ruby干掉

代码:

 # Enter your code here. Read input from STDIN. Print output to STDOUT
num = [0, 0]
num[0], num[1], n = readline.chomp.split(' ').map {|e| e.to_i}
(n - 2).times do
tmp = num[1] ** 2 + num[0]
num[0] = num[1]
num[1] = tmp
end
puts num[1]

HackerRank# Fibonacci Modified的更多相关文章

  1. Fibonacci Modified

    题目来源:Fibonacci Modified We define a modified Fibonacci sequence using the following definition: Give ...

  2. Buge's Fibonacci Number Problem

    Buge's Fibonacci Number Problem Description snowingsea is having Buge’s discrete mathematics lesson, ...

  3. PatentTips - Modified buddy system memory allocation

    BACKGROUND Memory allocation systems assign blocks of memory on request. A memory allocation system ...

  4. The best Fibonacci is achieved in js

    The best Fibonacci is achieved in js the best realized by using js 斐波那契数列 "use strict"; /* ...

  5. fibonacci number & fibonacci sequence

    fibonacci number & fibonacci sequence https://www.mathsisfun.com/numbers/fibonacci-sequence.html ...

  6. fibonacci all in one

    fibonacci all in one fibonacci sequence https://www.mathsisfun.com/numbers/fibonacci-sequence.html f ...

  7. 算法与数据结构(九) 查找表的顺序查找、折半查找、插值查找以及Fibonacci查找

    今天这篇博客就聊聊几种常见的查找算法,当然本篇博客只是涉及了部分查找算法,接下来的几篇博客中都将会介绍关于查找的相关内容.本篇博客主要介绍查找表的顺序查找.折半查找.插值查找以及Fibonacci查找 ...

  8. 为什么你SQL Server的数据库文件的Date modified没有变化呢?

    在SQL Server数据库中,数据文件与事务日志文件的修改日期(Date Modified)是会变化的,但是有时候你会发现你的数据文件或日志文件的修改日期(Date Modified)几个月甚至是半 ...

  9. #26 fibonacci seqs

    Difficulty: Easy Topic: Fibonacci seqs Write a function which returns the first X fibonacci numbers. ...

随机推荐

  1. you don't have permission to access / on this server解决

    时间:2014-10-13 17:34来源:有何不可 作者:有何不可 举报 点击:56151次 项目部署到Apache Http Server上面,通过apachectl -t 检测配置文件也没有问题 ...

  2. shell中使用ssh

    ssh服务是不能用非交互的方式传递密码,想不输入密码,直接ssh连接到服务器有两种方法,sshpass和expect sshpass # wget http://downloads.sourcefor ...

  3. gvim -- 跳转命令,查找格式,正则

    1.跳转命令 ‘w'单词前进,'b'单词后退,'e'单词前进,‘ge’单词后退,存在单词词首词尾区别,'W''B''E''gE'将不以单词区分,以空格区分 ‘$’行尾,'^'非空白行首,'0'行首 ‘ ...

  4. 将从SQL2008 r2里备份的数据库还原到SQL2008中

    从标题可以看出这是未解决上一篇遗留问题写的,现在我也不知道这个可不可以成功,方法似乎查到了一种,具体怎样还不清楚:而且,我想说的是“我踩雷了”. 这篇的主角是“Database Publishing ...

  5. Windows Dos命令下查看端口号,杀死端口

    PS:本文以 Redis 默认端口 6379 为例   1,首先查询该端口的 pid,使用命令 [netstat -ano | findstr 端口号]   F:\Program Files\Redi ...

  6. Python 基础-3

    使用while打印1 2 3 4  5 6   8 9 10 count = 0 #while count < 10: while count < 10: count += 1 if co ...

  7. ftl-server静态资源服务器

    ftl-server 是一前端开发工具,支持解析freemarker模板,模拟后端接口,反向代理等功能. 特性 解析freemarker模板 静态资源服务 mock请求 代理请求 livereload ...

  8. C++基础:虚函数、重载、覆盖、隐藏<转>

    转自:http://www.2cto.com/kf/201404/291772.html 虚函数总是跟多态联系在一起,引入虚函数可以使用基类指针对继承类对象进行操作! 虚函数:继承接口(函数名,参数, ...

  9. url编码和解码平台

    http://meyerweb.com/eric/tools/dencoder/

  10. CPP-练习

    HW: 1.局部变量能否和全局变量重名? 答:能,局部会屏蔽全局.要用全局变量,需要使用"::" ;局部变量可以与全局变量同名,在函数内引用这个变量时,会用到同名的局部变量,而不会 ...