题意
There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). 输入n,若F(n)能被3整除,输出yes,否则no
题解
列一下前几项F(i)可以发现n%4==2则是yes,否则no.
代码
#include#include #include #include using namespace std;int main() { int n; while(~scanf("%d",&n)){ if(n%4==2)puts("yes"); else puts("no"); } return 0;}