1021 Fibonacci Again
2016-02-27 17:35
260 查看
1021 Fibonacci Again
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
#include<stdio.h>
int main()
{
long long n;
while(scanf("%lld",&n)!=EOF)
{
if((n-2)%4==0) printf("yes\n");
else printf("no\n");
}
}
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
#include<stdio.h>
int main()
{
long long n;
while(scanf("%lld",&n)!=EOF)
{
if((n-2)%4==0) printf("yes\n");
else printf("no\n");
}
}
相关文章推荐
- 集训队专题(7)1001 Drainage Ditches
- train validation test
- 1090 Higest Price in Supply Chain
- 102.Daikon Forge基础使用label、button、sprite、textureAtlas、font
- UVA 10976(p183)----Fractions Again?!
- VS2012 error C2664: “std::make_pair”:无法将左值绑定到右值引用
- 101.Daikon Forge插件介绍和安装
- 格式化数据#8: AIE实验室交流群推荐的相关书籍(附豆瓣链接和ISBN)
- hdu 1151 Air Raid
- DNS IP DOMAIN 详解
- 解决dubbox-demo-provider.xml报错的问题:提示Failed to read schema document
- 【leetcode】【11】Container With Most Water
- 如何解决Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]
- leetcode 11.Container With Most Water
- 70. Climbing Stairs
- 常见xml的属性大全 转自:http://wenku.baidu.com/link?url=5IqajvhRVAlO7Fr1Ee_IP1rxbwEQU3e6RM5Szde_egqZFf0rma4ZeN
- 利用inotifywait监控主机文件和目录
- WM_PAINT 与 WM_ERASEBKGND(三种情况,比较清楚)
- 窗口绘制有关的消息整理 WM_PAINT, WM_NCPAINT, WM_ERASEBKGND
- WM_PAINT与WM_ERASEBKGND