【解题方法】知道如何求广义的fibonacci的循环节,这就是水题了。我还不懂欧拉降幂的那一套。贴个学习网址吧---http://blog.csdn.net/ACdreamers/article/details/25616461

【代码君】

//
//Created by just_sort 2016/10/5
//Copyright (c) 2016 just_sort.All Rights Reserved
//
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long mod1=26880696;
long long mod2=20160519;
int n;
long long m;
long long get(long long n,long long p)
{
    if (n==0) return 0;
    if (n==1) return 1%p;
    long long a[2][2]= {1,1,1,0};
    long long b[2][2]= {1,0,0,0};
    long long c[2][2];
    n--;
    while (n)
    {
        if (n&1)
        {
            memset(c,0,sizeof(c));
            for (int k=0; k<2; k++)
            {
                for (int i=0; i<2; i++)
                {
                    for (int j=0; j<2; j++)
                    {
                        c[i][j]+=a[i][k]*b[k][j]%p;
                        c[i][j]%=p;
                    }
                }
            }
            memcpy(b,c,sizeof(b));
        }
        memset(c,0,sizeof(c));
        for (int k=0; k<2; k++)
        {
            for (int i=0; i<2; i++)
            {
                for (int j=0; j<2; j++)
                {
                    c[i][j]+=a[i][k]*a[k][j]%p;
                    c[i][j]%=p;
                }
            }
        }
        memcpy(a,c,sizeof(a));
        n>>=1;
    }
    return b[0][0]%p;
}
int main()
{
    scanf("%d",&n);
    while (n--)
    {
        scanf("%lld",&m);
        m=get(m,mod1);
        m=get(m,mod2);
        printf("%lld\n",m);
    }
    return 0;
}