http://acm.hdu.edu.cn/showproblem.php?pid=10Fibonacci的兔子問(wèn)題要改了,mod 3的遞推數(shù)列肯定得有循環(huán)節(jié)吧,把第一個(gè)循環(huán)找到,
{1,2,0,2,2,1,0,1},恰好是從第一位開(kāi)始,OK:
#include<stdio.h>
int main()
{
int n,f[8]={1,2,0,2,2,1,0,1};
while (scanf("%d",&n)!=-1)
{
if (f[n%8]==0)
printf("yes\n");
else
printf("no\n");
}
}
ps:水題啊水題嘛。