题干
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).
Input
Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000).
Output
Print the word "yes" if 3 divide evenly into F(n).
Print the word "no" if not.
还有另一类斐波那契数:F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2)。
Input
输入由一系列行组成,每一行包含一个整数n。1000000)。
Output
如果3人平均分成F(n),打印单词“yes”。
如果不是,打印单词“no”。
测试案例
Input
1 | 0 |
Output
1 | no |
题意与思路
给定一个斐波那契数列: n
,3
。
3
的整除性 也具有加法的递推关系: $$ 可以看出,
周期为 8
,当且仅当
题解
1 |
|