//Ttensor.cc //ecna 2009 // problem F - Here's a Product Which Will make you Tensor #include using namespace std; int row, col; int Total; int M[500][500], A[500][500], B[500][500]; //for debugging void printM(int r, int c){ for(int i=0;i=1;i--) if(gcd % i == 0) ThisCount++; return ThisCount; } //know r | row && c | col int CountTensors(int r, int c){ int gcd; bool OK; // find B gcd = M[0][0]; for(int R=0; R0 || upperCol>0){ //see if mult of B for(int R=0;R>row >> col; while(row>0){ //get matrix for(int r=0;r>M[r][c]; Total = 0; for(int R=1;R<=row;R++) if(row % R == 0) for(int C=1;C<=col;C++) if(col % C == 0) if(C!=1 || R!=1) if(C!=col || R!=row){ //non-trivial submatrix //submatrix of dim (R,C) divides (row,col) Total += CountTensors(R,C); } cout<>row>>col; } return 0; }