题目大意:定义一种新的斐波那契数,f[0]=7%3,f[1]=11%3,f[n]=(f[n-1]%3+f[n-2]%3)%3,现在输入一个n ,判断f[n]能否被3整除。
解题报告:简单数学题,直接判断if(n%8==2||n%3==6)就可以了,是就输出yes,否则输出no .
1 #include<cstdio> 2 int main ( ) { 3 int n; 4 while(scanf("%d",&n)!=EOF) { 5 if(n%8==2||n%8==6) 6 printf("yes\n"); 7 else printf("no\n"); 8 } 9 return 0; 10 }