combinations

    1熱度

    1回答

    我想找到一種方法來組合2個列表,然後以特定方式對組合列表求和。前兩個元素的總和必須加總到下一個元素。例如:由於1 + 2 = 3,3 + 4 = 7,因此第一組合((1,2),(4,))的和應爲 (3,7,6) 2 + 4 = 6。 ((1,2),(4,))(3,7,6)如果它(包括組合和它的和)都不包含某個元素(不知何故,插入)。 這裏是我的代碼和我的例子: a=[1,2,3] b=[4,5,

    0熱度

    1回答

    我有一個方法返回給定字符串中3個元素的所有可能的組合。 void FindAllCombinationsBy3(string &str, int start) { for (int i = 0; i < str.length() - 2; i++) { for (int j = i + 1; j < str.length() - 1; j++) {

    -1熱度

    1回答

    我有一個RDD像這樣(所有的數字都是智力)鍵的組合: (2,List(2,2,7)) (7,List(9,7,9)) (9,List(2,7,9)) 如何產生的RDD使得對於每個列表中,我們擁有密鑰的所有可能性: (2,List(2,2,7)) (7,List(2,2,7)) (9,List(2,2,7)) (2,List(9,7,9)) (7,List(9,7,9)) (9,L

    -1熱度

    1回答

    我試圖創建R值的連續排列,但不能將其創建爲每個我的需要。這是預期的 ID Val Perm 1 Perm 2 Perm3 Perm 4 Perm 5 Perm 6 Perm 7 Perm 8 Perm 9 Perm 10 Perm 11 Perm 12 Perm 13 Perm 14 Perm 15 Perm 16 Perm 17 Perm 18 Perm 19 Perm 20 Perm 21

    0熱度

    1回答

    我想準備一個動態置換爲數據集設置,使得它看起來這個 ID Val Perm 1 Perm 2 Perm3 Perm 4 Perm 5 Perm 6 Perm 7 Perm 8 Perm 9 Perm 10 Perm 11 Perm 12 Perm 13 Perm 14 Perm 15 Perm 16 Perm 17 Perm 18 Perm 19 Perm 20 Perm 21 Perm 22

    0熱度

    1回答

    我想查找數組內容與索引的組合。此外,與動態組合長度。現在我可以結合這個沒有返回索引: print("Combination result: ") for L in range(1, len(splitword)+1): comb = combinations(splitword, L) for combine in comb: print(combine) 我

    2熱度

    1回答

    我在尋找3個二進制輸入A,B和C(使用它們全部)的可能組合的可能組合,將給出它們之間可用的操作符範圍。我們有OR,AND,XOR和不可用的,我有這個名單的結論: A & (B & C), !A & (B & C), !A & (!B & C), !A & (!B & !C) A & (B | C), !A & (B | C), !A & (!B | C), !A & (!B | !C) A &

    0熱度

    1回答

    我有一個20字節的字符串,我從中取出5個四字節的數組(前四個字節=數組1等)。 我必須通過一個特定的函數將每個數組轉換爲小數。 這樣,我將以5個整數結束。 我必須添加這5個整數並達到一個特定的數字(4863101420)。 你有什麼想法如何猜測20個原始字符的一個可能的組合 - 經歷分解成數組和解碼爲整數的過程 - 將加起來4863101420,而不經過類似itertools.combinatio

    1熱度

    2回答

    我有三個變量:X,Y和Z.我想找到X,Y和Z的所有組合,總計爲100. X,Y Z只能取[0,100]之間的值。在輸出中應該somehtinkg這樣的: X Y Z Sum 100 0 0 100 99 1 0 100 99 0 1 100 98 2 0 100 98 1 1 100 98 0 2 100 等等... 上任何建議如何得到所有可能的組合?

    0熱度

    2回答

    如何重新排列表以獲取Mysql中現有組合(在兩個方向上)的列表? 例如,我有兩列 col1 col2 1 5 7 1 1 2 我希望得到一個新的表(添加到現有的表),其中我翻動COL2和COL1表。 col1 col2 1 5 7 1 1 2 5 1 1 7 2 1 這使我可以在看到兩個方向時看到每個數字的所有值。 像 1: 5, 2, 7 2: 1