CDZSC_2015寒假新人(2)——数学 D
2024-08-24 21:06:03
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
1
2
3
4
5
Sample Output
no
no
yes
no
no
no
no
yes
no
no
no
#include<iostream>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;
int a[];
int main()
{
a[]=;
a[]=;
for(int i=;i<;i++)
{
a[i]=(a[i-]+a[i-])%;
}
int n;
//printf("%.2f",(double)clock()/CLOCKS_PER_SEC);
while((scanf("%d",&n))!=EOF)
{
if(a[n]%==)
{
printf("yes\n");
}
else
{
printf("no\n");
}
}
}
最新文章
- Sencha ExtJS 6 Widget Grid 入门
- windows和linux中搭建python集成开发环境IDE——如何设置多个python环境
- string黑科技
- Linux top和负载的说明
- beta版本贡献率
- 颜色缩减(带Trackbar)【从毛星云Opencv3编程入门P75 P111例程改编】
- ExtJs之addManagedListener
- centos安装memcache与telnet
- Html5 js FileReader接口
- linux命令之more
- MVC Filter自定义验证(拦截)
- Splay tree
- BZOJ 1217: [HNOI2003]消防局的设立( 贪心 )
- SecureCRT, SecureFX连接Linux时中文乱码解决办法
- php中常用的字符串长度函数strlen()与mb_strlen()实例解释
- ArcGIS License启动无响应
- Struts2笔记_值栈
- 依赖注入[4]: 创建一个简易版的DI框架[上篇]
- git 环境搭建
- Web前端学习第三天(cookie 二)
热门文章
- VC:CString用法整理(转载)
- FCKeditor 插件开发 示例
- [Mugeda HTML5技术教程之19]制作可定制贺卡
- 如何让你的 footer 总是在浏览器底部无论什么分辨率无论什么浏览器?
- 手机user agent大全下载 整理发布一批移动设备的user agent【分享】
- 判断display为隐藏还是显示及获取css
- 【笔记】shell下的主要工具
- Manasa and Stones
- BZOJ 1264 基因匹配Match(LCS转化LIS)
- Windows 8.1 Update1 6610 32位/64位下载、安装和新增功能简评