| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 536 人关注过本帖
标题:Fibonacci 问题
只看楼主 加入收藏
利剑出鞘
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-5-18
收藏
 问题点数:0 回复次数:1 
Fibonacci 问题
Problem Description
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).

Input
Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000).

Output
Print the word "yes" if 3 divide evenly into F(n).

Print the word "no" if not.

Sample Input
0
1
2
3
4
5

Sample Output
no
no
yes
no
no
no
搜索更多相关主题的帖子: Fibonacci 
2008-09-29 17:06
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 
这个估计要先找到规律(例如mod循环结),然后解决。
ps:或者用logn Fibonacci公式,不过不清楚那个公式是否适用于7 11

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2008-09-29 17:36
快速回复:Fibonacci 问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011112 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved