传送门 高斯消元练习. 模板: void Guass(){ int waited; up(i,1,N){ waited=i; up(j,i+1,N)if(fabs(M[j][i])>fabs(M[waited][i]))waited=j; if(waited!=i)up(j,1,N+1)swap(M[i][j],M[waited][j]); up(k,i+1,N){ db f=M[k][i]/M[i][i]; up(j,i,N+1)M[k][j]-=f*M[i][j]; } } down(i,N…