python3:
t = int(input())
for i in range(t):
n = int(input())
string = []
for i in range(n):
temp = [ord(i) for i in input()]
temp.sort()
string.append(temp)
string = [tuple(i) for i in string]
string = set(string)
print(len(string))
for i in range(t):
n = int(input())
string = []
for i in range(n):
temp = [ord(i) for i in input()]
temp.sort()
string.append(temp)
string = [tuple(i) for i in string]
string = set(string)
print(len(string))
超时怎么办,有没有更优化的解法
全部评论
(0) 回帖