比如{3,2,4,3,6} 可以分成 {3,2,4,3,6} m=1; {3,6}{2,4,3} m=2 {3,3}{2,4}{6} m=3 所以m的最大值为3. bool isShare(int* a, int* group, int len, int m, int groupSize, int groupId, int curSize) { if (curSize == 0) { groupId++; curSize = groupSize; if (groupId == m + 1) {
int getSum(int* arr, int len) { int sum = 0; for (int i = 0; i < len; ++i) { sum += arr[i]; } return sum; } void difPrint(int* arr, int len, vector<int> vct) { cout << vct.size() << " =m 数组: "; for (int i = 0; i < vct.siz
l1 = [183,0,1,2,-184,367] num = [] for i in range (0,len(l1)): for l in range (i+1,len(l1)): if l1[i]+l1[l]==183: num.append((l1[i],l1[l])) sum = set(num) print(sum) //set():去重
// ConsoleApplication5.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<vector> #include<iostream> using namespace std; class MaxInnerRec { public: int countArea(vector<int> A, int n) { vector<int> areas; for (int i =
// ConsoleApplication10.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> #include <vector> #include <string> using namespace std; class BinarySearch { public: int getPos(vector<int> A, int n, int val) { //
class Solution { public int[] twoSum(int[] nums, int target) { for (int i = 0; i < nums.length;i++){ for(int j = i + 1;j < nums.length;j++){ if (nums[j] == target - nums[i]){ return new int