对字符串倒序,然后dp[i][j]表示第i个字符串,模为j的种类数 s="???5" s=s[::-1] dp=[[0 for i in range(13)] for j in range(len(s)+1)] ti=[1,10,100] flag=1 dp[0][0]=1 i=1 while i<len(s)+1: if s[i-1]=='?': for d in range(10): ls=(d*ti[i%3-1])%13*flag for j in range(13): ...