[恢]hdu 1021

2011-12-15 01:34:16

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1021

题意:fibonacci变种,f[0] = 7, f[1] = 11。问第n项是否能被3整除。

mark:打表看规律,循环节为3,模8后为2或6的则为3的倍数。

代码:

# include <stdio.h>


int main ()
{
int n ;
while (~scanf ("%d", &n))
if (n%8 == 2 || n%8 == 6) puts ("yes") ;
else puts ("no") ;
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314609.html