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.
Print the word "no" if not.
规律:
当n=2时,满足能被3整除,以后n每加4满足条件,能被3整除。即当n除以4余2时,满足条件。
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cmath>
#include<iomanip>
//#define P 3.141592653
using namespace std;
void main()
{
int n;
while (cin >> n)
{
if (n%4==2)
cout << "yes" << endl;
else
cout << "no" << endl;
}
system("pause");
}