高斯消元模板(取余方程组)

const int maxn = 110;
const int mod  = 2;
int a[maxn][maxn],x[maxn],free_x[maxn],free_num;
int Qpow( int a , int b )
{
    int res = 1;
    while ( b )
    {
        if ( b&1 )
            res = res*a%mod;
        a = a*a%mod;
        b = b>>1;
    }
    return res;
}
int Gauss( int equ , int var )
{
    int max_r,col,k;
    free_num = 0;
    for ( k=0,col=0 ; kAbs( a[max_r][col] ) )
                max_r = i;
        if ( a[max_r][col]==0 )
        {
            k--;
            free_x[free_num] = col;
            continue;
        }
        if ( max_r!=k )
            for ( int j=col ; j=0 ; i-- )
    {
        x[i] = a[i][var];
        for ( int j=i+1 ; j

 

你可能感兴趣的:(数论模板)