hdu 1021 斐波那契数列取模(循环节)
来源:互联网 发布:mybatis的sql语句like 编辑:程序博客网 时间:2024/05/18 17:05
http://acm.hdu.edu.cn/showproblem.php?pid=1021
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
012345
Sample Output
nonoyesnonono
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int a[50];int main(){ int n; a[0]=7; a[1]=11; for(int i=2;i<=8;i++) a[i]=a[i-1]+a[i-2]; while(~scanf("%d",&n)) { n=n%8; n=a[n]%3; if(n==0) printf("yes\n"); else printf("no\n"); } return 0;}
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
012345
Sample Output
nonoyesnonono
0 0
- hdu 1021 斐波那契数列取模(循环节)
- HDU 4794 Arnold 斐波那契数列循环节
- HDU 4794 斐波那契数列循环节
- hdu 1021 Fibonacci Again(斐波那契数列,取余)
- HDU 5674 Function(斐波那契模数列循环节)
- HDU 3977 Evil teacher(斐波那契数列循环节)
- HDU 2814 斐波那契数列的循环节问题
- 斐波那契数列取余
- 斐波那契数列循环实现
- HDU2813Interesting Fibonacci(斐波那契数列+循环节)
- 51nod1195斐波那契数列的循环节
- 斐波那契数列 (递归 循环)
- 斐波那契数列取模(大数)分治算法
- HITOJ 2060 类似斐波那契数列(一段和取模)
- Sicily E1_fib1 斐波那契数列取模(大数)分治算法
- 【转】斐波那契数列取模(大数)分治算法
- 斐波那契数列取模(大数)分治算法
- hdu 3117 斐波那契数列
- c++ 封装luatinker
- OpenCV学习笔记16 OpenCV图像处理模块ImgProc Module. Image Processing(九)
- POJ 1177 Picture
- sdfgsdfgdsfg
- poj 1789 Truck History(图论:最小生成树)
- hdu 1021 斐波那契数列取模(循环节)
- 检查表的HWM Script
- sdfgsdfghdfghdfg
- Linux下离线安装R和RServe
- 全自动过滤器:自动叠片式过滤器详细介绍
- sdfhdfghdfghdfgh
- asdfsdfsdfsdfsdfsdfsdfsdfsdf
- Java反射机制
- private bytes working set virtual bytes