*Language: Python 3* Hello,
def sumtracing(mx,n): s=0 for i in range(n): s+=mx[i][i] return s def countIdenticalRows(mat): count = 0 for i in range(len(mat)): hs=dict() #Traverse the row for j in range(len(mat[i])): #Add all the values of the row in HashSet hs[mat[i][j]]=1 #Check if size of HashSet = 1 if (len(hs)== 1): count+=1 return count def countIdenticalColumn(mat): count = 0 for i in range(len(mat)): hs=dict() #Traverse the row for j in range(len(mat[i])): #Add all the values of the row in HashSet hs[mat[j][i]]=1 #Check if size of HashSet = 1 if (len(hs)== 1): count+=1 return count def CreateMartix(R,C): matrix = [] # For user input for i in range(R): # A for loop for row entries a =[] for j in range(C): # A for loop for column entries a.append(int(input())) matrix.append(a) return matrix def main(): for _ in range(1,int(input())+1): order = int(input().strip()) trace= 0; No_row = 0; No_Column = 0; flag=False for i in range(1,order+1): x=CreateMartix(order,order) trace =sumtracing(x,order) No_row = countIdenticalRows(x) No_Column = countIdenticalColumn(x) print("Case " + str(_) + "# ",end="") print(trace,No_row,No_Column,sep=" ") main() -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/7460e61a-03aa-442f-8b74-4b88de641390%40googlegroups.com.