Problem DescriptionThere are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000). OutputPrint the word "yes" if 3 divide evenly into F(n).Print the word "no" if not. Sample Input012345 Sample Outputnonoyesnonono
题目 看起来确实也没啥规律但是先写一下,写出来之后就有规律了,在纸上花花看看,这个是属于比较简单的找规律题目,前些天遇到了一个需要用前三项来确定下一项的题,那时候没做出来.唉,还是应该先写一个稳稳地大数超时错答案,然后从中开始寻找答案之间的规律.
附上代码
#include<stdio.h>
int main(){ int n; while(scanf("%d",&n)!=EOF) { if(n%4==2) printf("yes\n"); else printf("no\n"); }}