数学
Problem Description
现在,有一个新的斐波那契数列,定义如下:
F(0) = 7,
F(1) = 11,
F(n) = F(n-1) + F(n-2) (n>=2).
Input
输入包含多组测试样例,每组测试样例包含一个整数n(n < 1,000,000).
Output
如果F(n)能够被3整除,请输出”yes”,否则请输出”no”。
Sample input
0
1
2
3
4
5
Sample output
no
no
yes
no
no
no
点击查看代码
#include<bits/stdc++.h>
using namespace std;
int a[8]={1,2,0,2,2,1,0,1};
int main()
{
int n;
while(scanf("%d",&n)==1)
{
if(a[n%8]) cout<<"no"<<'\n';
else cout<<"yes"<<'\n';
}
return 0;
}
posted on
浙公网安备 33010602011771号