python
2025-05-24 11:11:48
发布于:浙江
2阅读
0回复
0点赞
要用到itertools.product方法和[*]字面量运算,哈希表等
from itertools import product
two=[*"abc"]
three=[*"def"]
four=[*"ghi"]
five=[*"jkl"]
six=[*"mno"]
seven=[*"pqrs"]
eight=[*"tuv"]
nine=[*"wxyz"]
hash={2:two,3:three,4:four,5:five,6:six,7:seven,8:eight,9:nine}
n=int(input())
l=list(map(int,input().split()))
l=[hash[i] for i in l]
crack=list(product(*l))
print(len(crack))
for i in crack:
print(''.join(i))
这里空空如也
有帮助,赞一个