题目描述
现在,有一个新的斐波那契数列,定义如下:
F(0) = 7,
F(1) = 11,
F(n) = F(n-1) + F(n-2) (n>=2).
输入
输入包含多组测试样例,每组测试样例包含一个整数n(n < 1,000,000).
输出
如果F(n)能够被3整除,请输出"yes",否则请输出"no"。
样例输入 Copy
0 1 2 3 4 5
样例输出 Copy
no no yes no no no
#include<iostream>
using namespace std;
int main() {
int n;
while (cin >> n)
{
if (n == 0 && n == 1)
cout << "no" << endl;
else {
n = n - 2;
if (n % 4)
cout << "no" << endl;
else
cout << "yes" << endl;
}
}
return 0;
}