题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3221
AC代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=10000;
ll n,p,aa,b;
const ll maxn=1e6+10;
ll phi[maxn];
struct mat
{
ll a[2][2];
};
mat mat_mul(mat x,mat y)
{
mat res;
memset(res.a,0,sizeof(res.a));
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
for(int k=0;k<2;k++){
res.a