给出新的数列: 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 }

相关文章:

  • 2021-11-09
  • 2021-08-13
  • 2022-12-23
  • 2021-12-05
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-02-02
  • 2021-08-20
  • 2021-12-03
  • 2021-11-25
相关资源
相似解决方案