题目地址:https://vjudge.net/problem/HDU-1021

解题思路:

循环节的长度为8,f[0]~f[7],f[8]~f[15]

ac代码:

#include <bits/stdc++.h>
#define  maxn 1005
typedef long long ll;
const ll inf=1e+18;
using namespace std;
int main()
{
    int f[10],i;
    f[0]=7;f[1]=11;
    //freopen("/Users/zhangkanqi/Desktop/11.txt","r",stdin);
    for(int i=2;i<=7;i++)
        f[i] = f[i - 1] + f[i - 2];
    while(scanf("%d",&i)!=EOF)
    {
        i=i%8;
        if(f[i]%3)
            printf("no\n");
        else
            printf("yes\n");
    }
    return 0;
}