using Eigen Value
用矩阵特殊值
矩阵 2 1 0 的特征向量为 (1,2,1) (-1, 0, 1), 对应的特征值为4, 2;
2 2 2
0 1 2
#include<cstdio>
const int divisor=10007;
int n, now;
int get_mod(int x, int y){
int mod=y, ans=1;
for (int i=x; i>0; i>>=1){
if (i&1) ans=ans*mod%divisor;
mod=mod*mod%divisor;
}
return ans;
}
int main(){
scanf("%d", &n);
for (int i=0; i<n; i++){
scanf("%d", &now);
int c=(get_mod(now-1,2)+get_mod(now-1,4)) % divisor;
printf("%d\n", c);
}
}