void-man

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

给出新的数列: another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2)

第n个斐波那契数列是否能被3整除...

找规律问题,找出规律后发现8个行程循环,第三个和第七个可以被三整除

1 #include <stdio.h>
2  int main()
3 {
4 int n;
5 while(scanf("%d",&n)!=EOF)
6 if((n+1)%8==3||(n+1)%8==7)printf("yes\n");
7 else printf("no\n");
8 return 0;
9 }
posted on 2011-04-15 22:30  void-man  阅读(333)  评论(0)    收藏  举报