博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 1021 Fibonacci Again
阅读量:7187 次
发布时间:2019-06-29

本文共 929 字,大约阅读时间需要 3 分钟。

Fibonacci AgainTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44439    Accepted Submission(s): 21214Problem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).OutputPrint the word "yes" if 3 divide evenly into F(n).Print the word "no" if not.Sample Input012345Sample Outputnonoyesnonono

解题思路:实在没啥说的,就是找寻环节,直接上代码吧,其实还可以用矩阵乘法做,感觉有点麻烦,但是为了学会矩阵乘法,我觉定要用矩阵做一下,当然这是待会的事情了,嘿嘿:

/*2015 - 8 - 13Author: ITAK今日的我要超越昨日的我,明日的我要胜过今日的我,以创作出更好的代码为目标,不断地超越自己。*/#include 
#include
using namespace std;int data[30];int main(){ /* 打表看一下,找寻环节 data[0] = 7; data[1] = 11; for(int i=2; i<30; i++) data[i] = data[i-1]+data[i-2]; for(int i=0; i<30; i++) if(data[i]%3 == 0) cout<
<

转载地址:http://ujfkm.baihongyu.com/

你可能感兴趣的文章
安卓数据传递之---putextra与putextras
查看>>
【后会有期】
查看>>
Codeforces Round #346 (Div. 2) - D Bicycle Race
查看>>
nginx php上传大小设置
查看>>
spring原理机制
查看>>
Oracle分析函数-nulls first/nulls last
查看>>
Python中时间类解决类似朋友圈时间显示的小问题
查看>>
NodeJs针对Express框架配置Mysql进行数据库操作
查看>>
基于MNIST数据集使用TensorFlow训练一个没有隐含层的浅层神经网络
查看>>
Hive修改表
查看>>
Leetcode刷题记录:编码并解码短网址
查看>>
【数据分析】Superset 之四 直接安装
查看>>
Swift - what's the difference between metatype .Type and .self?
查看>>
Matroid[转]
查看>>
Android 实现歌词同步
查看>>
c#设计模式-观察者模式
查看>>
如何使用cocos2d制作基于tile地图的游戏教程:第一部分
查看>>
SVN的版本日期
查看>>
圆满完成性能测试诊断分析与优化周末班培训课程!
查看>>
C# 通过消息捕获处理窗体最大化/最小化
查看>>