hdu_1021_Fibonacci Again_201310232237
2024-08-23 14:00:49
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.
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 这两题类似
最新文章
- bzoj3048+3049+3050
- SUSE Linux下新建Weblogic 10.3非admin服务
- HackerRank ";Square Subsequences"; !!!
- PP66 EEPPPPMM SSyysstteemm AAddmmiinniissttrraattiioonn GGuuiiddee 16 R1
- 记录C++学习历程
- SQL注入原理一
- Uva 10288 Coupons
- 在Xcode中使用Clang Format
- C# 泛型初探
- ROS机器人程序设计(原书第2版)补充资料 (零) 源代码、资料和印刷错误修订等 2017年01月01日更新
- java 操作Excel表格
- AssetBundle打包
- robotframework中的try exception。断言失败后,后面语句能继续执行
- Linux下安装whl文件
- opencv学习之路(22)、轮廓查找与绘制(一)
- SparkSql处理嵌套json数据
- Hive之一:hive2.1.1安装部署
- HttpServletResponse对象(一)
- NGUI图集字体
- [摘]HttpContext, HttpRequest, HttpResponse, HttpRuntime, HttpServerUtility
热门文章
- hebernate基础学习2---属性
- [Swift通天遁地]八、媒体与动画-(3)实现视频播放的水印、Overlay、暂停时插入广告等效果
- php从数据库读取中文显示问号??的解决办法
- Patch 21352635 - Database Patch Set Update 11.2.0.4.8
- Flume特点
- D3.js 力导向图(气泡+线条+箭头+文字)
- Jquery 《不想工作系列》--整理一下append、prependTo、after的区别
- iOS动画——CoreAnimation
- Android基础TOP2_1:输出系统时间
- (一)Python 学习第一天--基础知识,列表