Y
来源:互联网 发布:mac安装exe软件 编辑:程序博客网 时间:2024/04/18 03:28
Subject
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 aninteger n. (n < 1,000,000).
**************************************************************************************************
Output
Print the word "yes" if 3 divide evenly intoF(n).
Print the word "no" if not.
**************************************************************************************************
Sample Input
0
1
2
3
4
5
**************************************************************************************************
Sample Output
no
no
yes
no
no
no
**************************************************************************************************
找规律就好了。输出前几个看看,就出来了。
**************************************************************************************************
代码如下:
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int a[2]; int main(){int n;a[0]=1;a[1]=1;while(scanf("%d",&n)!=EOF){int sum;if(n<2){sum = a[n];}else{ sum = (n-2)%4;}if(!sum){ printf("yes\n");}else{ printf("no\n");}}return 0;}**************************************************************************************************
- y
- y
- Y
- Y
- Y
- Y
- y
- Y
- Y
- y
- Y
- Y
- Y
- Y
- Y
- Y
- Y
- Y-Combinator
- hdu 4496 D-City (并查集)
- kotlin学习的一些学习资源,你需要收藏了
- 设计模式学习笔记——装饰器模式
- 分布式消息队列RocketMQ与Kafka架构上的巨大差异之2 -- CommitLog与ConsumeQueue
- 196. Delete Duplicate Emails
- Y
- sprintf函数用法详解
- [题解]codeforces 438d The Child and Sequence
- Oracle 10g安装教程
- 评教管理系统
- Asp.net创建Datatable并赋值
- opencv 之运动物体检测(二)
- 杨氏矩阵查找的Java实现
- 分布式消息队列RocketMQ源码分析之3 -- Consumer负载均衡机制 -- Rebalance