hdu1575 快速幂

#include 
#include 
#include 
#define MAX 15
using namespace std;
struct matrix
{
    int num[MAX][MAX];
    matrix()
    {
        memset(num,0,sizeof(num));
    }
};
matrix res;
matrix A;
int n,k;
matrix operator*(matrix &a,matrix &b)
{
    matrix t;
    int i,j,k;
    for(i=0;i=1)
    {
        if(x&1)
            res=res*A;
        x>>=1;
        A=A*A;
    }
}


int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d",&n,&k);
        int i,j;
        for(i=0;i


你可能感兴趣的:(acm题目)