又是斐波那契数列-数学

Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %I64d & %I64u

[]   [Go Back]   [Status]  

Description

有另一种斐波那契数列:F(0)=7,F(1)=11,F(n)=F(n-1)+F(n-2) (n>=2)

Input

输入数据有多行组成,每一行上是一个整数n(n<1000000);

Output

如果F(n)能被3整除,那么打印一行"yes";否则,打印一行"no".

Sample Input

0
1
2
3
4
5

Sample Output

no
no
yes
no
no
no

Source

Timebug
 
 1 #include<iostream>
 2 #include<algorithm>
 3 #include<queue>
 4 #include<cstdio>
 5 #include<cstdlib>
 6 #include<cstring>
 7 #include<cmath>
 8 using namespace std;
 9 #define sr(x) scanf("%d",&x)
10 #define sc(x) printf("%d",x)
11 #define hh printf("\n")
12 #define mod 2011
13 int main()
14 {
15     int n;
16     while(sr(n)!=EOF)
17     {
18         n%=8;
19         if(n==2||n==6)printf("yes\n");
20         else printf("no\n");
21     } 
22     return 0;
23 }

 

posted on 2013-11-08 22:39  lveternal  阅读(193)  评论(0编辑  收藏  举报

导航