斐波纳契
#include<stdio.h>
int f[15] = {1, 2, 0, 2, 2, 1, 0, 1};
int main(){
int n;
while(scanf("%d", &n) == 1 ){
if(f[n%8]==0){
printf("yes\n");
}else{
printf("no\n");
}
}
return 0;
}
这篇博客探讨了如何使用斐波那契数列的性质,通过模运算快速判断序列中特定位置的数是否为0。代码示例展示了如何在C语言中实现这一算法,对于理解斐波那契数列的计算优化具有实践意义。
#include<stdio.h>
int f[15] = {1, 2, 0, 2, 2, 1, 0, 1};
int main(){
int n;
while(scanf("%d", &n) == 1 ){
if(f[n%8]==0){
printf("yes\n");
}else{
printf("no\n");
}
}
return 0;
}

被折叠的 条评论
为什么被折叠?