|
@@ -7,6 +7,10 @@ def jieChen(n):
|
|
|
myArray[i] = (i+1)*myArray[i-1];
|
|
|
i = i+1
|
|
|
return myArray;
|
|
|
+def jieChenNumber(n):
|
|
|
+ if(n <= 1):
|
|
|
+ return 1;
|
|
|
+ return jieChen(n)[n-1];
|
|
|
#辗转相除法进行进制转化
|
|
|
def changeInt2Str(i,m):
|
|
|
if(not isinstance(m,int)):
|
|
@@ -36,6 +40,30 @@ def getAllArray(m,n):
|
|
|
allArray[index]=itemIndex
|
|
|
index = index+1
|
|
|
print(allArray)
|
|
|
+#获取单个组合的各边重复项
|
|
|
+def getitemIndexArray(itemIndex,n):
|
|
|
+ a = {};
|
|
|
+ for item in range(n):
|
|
|
+ index = 0;
|
|
|
+ indexNum = 0;
|
|
|
+ while(index < n):
|
|
|
+ if(itemIndex[index] == str(item)):
|
|
|
+ indexNum = indexNum + 1
|
|
|
+ index = index+1
|
|
|
+ a[item]=indexNum
|
|
|
+ print(a)
|
|
|
+ return a
|
|
|
+def getitemIndexArrayNumber(itemIndex,n):
|
|
|
+ itemIndexArrayNumber = 0;
|
|
|
+ a = getitemIndexArray(itemIndex,n)
|
|
|
+ for item in a:
|
|
|
+ intItem = int(a[item])
|
|
|
+ if(intItem > 1):
|
|
|
+ itemIndexArrayNumber = jieChenNumber(intItem)+itemIndexArrayNumber
|
|
|
+ return itemIndexArrayNumber
|
|
|
# result = changeInt2Str(14,3);
|
|
|
# print(result)
|
|
|
-getAllArray(2,3)
|
|
|
+# getAllArray(4,3)
|
|
|
+# getitemIndexArray("01200",5)
|
|
|
+number = getitemIndexArrayNumber("01200",5)
|
|
|
+print(number)
|