/*
题目描述: 斐波纳契数列的第n(1<n<1e9)项能否被3整除 , 能否被4整除 , 能否被12整除
方法:打表可发现斐波纳契数列的循环的特点:
对于第n项来说,如果n是4的倍数,则f[n]能整除3 ; 如果n是6的倍数,则f[n]能整除4 ; 如果n是4和6的公倍数,
则f[n]能整除12
*/
#pragma warning(disable:4786)
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#define LL long long
#define FOR(i,f_start,f_end) for(int i=f_start;i<=f_end;++i)
#define mem(a,x) memset(a,x,sizeof(a))
#define lson l,m,x<<1
#define rson m+1,r,x<<1|1
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
const double eps=1e-8;
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
if(n%4==0 && n%6==0){
printf("YES\n"); continue;
}
if(n%4==0){
printf("3\n"); continue;
}
if(n%3==0){
printf("4\n"); continue;
}
printf("NO\n");
}
return 0;
}
nefu115 斐波那契的整除 斐波纳契+打表
最新推荐文章于 2019-07-27 20:26:17 发布