Fibonacci Again

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 30227    Accepted Submission(s): 14685

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
 
Author
Leojay
 
 #include <stdio.h>

 int main()
{
int f[];
int n;
while(scanf("%d",&n)!=EOF)
{
int i,xh;
f[]=%;
f[]=%;
for(i=;i<;i++)
{
f[i]=(f[i-]+f[i-])%;
if(f[i]==&&f[i-]==)
break;
}
xh=i-;
n=n%xh;
if(f[n]==)
printf("yes\n");
else
printf("no\n");
}
return ;
}

思路详见hdu_1005  这两题类似

 

最新文章

  1. bzoj3048+3049+3050
  2. SUSE Linux下新建Weblogic 10.3非admin服务
  3. HackerRank &quot;Square Subsequences&quot; !!!
  4. PP66 EEPPPPMM SSyysstteemm AAddmmiinniissttrraattiioonn GGuuiiddee 16 R1
  5. 记录C++学习历程
  6. SQL注入原理一
  7. Uva 10288 Coupons
  8. 在Xcode中使用Clang Format
  9. C# 泛型初探
  10. ROS机器人程序设计(原书第2版)补充资料 (零) 源代码、资料和印刷错误修订等 2017年01月01日更新
  11. java 操作Excel表格
  12. AssetBundle打包
  13. robotframework中的try exception。断言失败后,后面语句能继续执行
  14. Linux下安装whl文件
  15. opencv学习之路(22)、轮廓查找与绘制(一)
  16. SparkSql处理嵌套json数据
  17. Hive之一:hive2.1.1安装部署
  18. HttpServletResponse对象(一)
  19. NGUI图集字体
  20. [摘]HttpContext, HttpRequest, HttpResponse, HttpRuntime, HttpServerUtility

热门文章

  1. hebernate基础学习2---属性
  2. [Swift通天遁地]八、媒体与动画-(3)实现视频播放的水印、Overlay、暂停时插入广告等效果
  3. php从数据库读取中文显示问号??的解决办法
  4. Patch 21352635 - Database Patch Set Update 11.2.0.4.8
  5. Flume特点
  6. D3.js 力导向图(气泡+线条+箭头+文字)
  7. Jquery 《不想工作系列》--整理一下append、prependTo、after的区别
  8. iOS动画——CoreAnimation
  9. Android基础TOP2_1:输出系统时间
  10. (一)Python 学习第一天--基础知识,列表