Fibonacci Again

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

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
 

【题意】:若F(n)%3==0输出yes

【分析】:根据打表找规律发现若n%4==2直接输出yes

【打表代码】:

#include<bits/stdc++.h>
using namespace std; int main()
{
int a[];
a[]=;
a[]=;
for(int i=;i<=;i++)
a[i]=a[i-]%+a[i-]%;
for(int i=;i<=;i++)
printf("%d\n",a[i]%);
}

打出部分表

【代码】:

#include<bits/stdc++.h>
using namespace std; int main()
{
int n;
while(cin>>n)
{
puts(n%==?"yes":"no");
}
}

注意yes大小写!

 【总结】:一般看到【类斐波那契数列】【%某个数】就想到找规律、打表

最新文章

  1. ABP文档 :Overall - Module System
  2. NSCharacter​Set在字符串操作中得使用
  3. 转: Vue.js——60分钟组件快速入门(上篇)
  4. systemd的原理和适用方法
  5. Python3 基础
  6. gulp 前端自动化工具
  7. HTTP 教程 转自 http://www.w3cschool.cc/http/http-tutorial.html
  8. 深入探索C++对象模型-语义
  9. LESS使用介绍
  10. XISE菜刀V21.0 官网版 XISE菜刀VIP破解版 XISE官网
  11. 在没有DOM操作的日子里,我是怎么熬过来的(终结篇)
  12. CSS 背景图像 重复图像
  13. Django的模板系统
  14. 原型链上的call方法集合
  15. Spring boot actuator端点启用和暴露
  16. IBM推出新一代云计算技术来解决多云管理
  17. Java多线程-----创建线程的几种方式
  18. 基于SecureCRT的测试环境的克隆的linux/vi相关命令
  19. swift - 启动APP 黑屏
  20. Linux下通过管道杀死所有与tomcat相关的进程

热门文章

  1. Patrick and Shopping
  2. SOA:面向服务编程——竹子整理
  3. Python之print函数详解
  4. mof格式的文件怎么打开?用什么工具?
  5. 怎么使用瓦特平台下面的“代码工厂”快速生成BS程序代码
  6. 【Combinations】cpp
  7. IOS笔记050-事件处理
  8. 聊聊、Java 命令 第三篇
  9. sqlserver导入dbf文件
  10. JavaScript: 理解对象