|
@@ -8,7 +8,6 @@ import com.aliyuncs.exceptions.ClientException;
|
|
|
import com.aliyuncs.exceptions.ServerException;
|
|
|
import com.aliyuncs.mts.model.v20140618.*;
|
|
|
import com.aliyuncs.profile.DefaultProfile;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.context.annotation.PropertySource;
|
|
|
|
|
@@ -56,7 +55,8 @@ public class MpsUtils {
|
|
|
*/
|
|
|
private static void arrangementSelect(String[] dataList, String[] resultList, int resultIndex) {
|
|
|
int resultLen = resultList.length;
|
|
|
- if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果
|
|
|
+ // 全部选择完时,输出排列结果
|
|
|
+ if (resultIndex >= resultLen) {
|
|
|
System.out.println(Arrays.asList(resultList));
|
|
|
return;
|
|
|
}
|
|
@@ -71,7 +71,8 @@ public class MpsUtils {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (!exists) { // 排列结果不存在该项,才可选择
|
|
|
+ // 排列结果不存在该项,才可选择
|
|
|
+ if (!exists) {
|
|
|
resultList[resultIndex] = dataList[i];
|
|
|
arrangementSelect(dataList, resultList, resultIndex + 1);
|
|
|
}
|
|
@@ -108,7 +109,7 @@ public class MpsUtils {
|
|
|
*/
|
|
|
public static void combinationSelect(String[] dataList, int n) {
|
|
|
System.out.println(String.format("C(%d, %d) = %d",
|
|
|
- dataList.length, n, combination(dataList.length, n)));
|
|
|
+ dataList.length, n, combination(n, dataList.length)));
|
|
|
combinationSelect(dataList, 0, new String[n], 0);
|
|
|
}
|
|
|
|
|
@@ -122,7 +123,8 @@ public class MpsUtils {
|
|
|
private static void combinationSelect(String[] dataList, int dataIndex, String[] resultList, int resultIndex) {
|
|
|
int resultLen = resultList.length;
|
|
|
int resultCount = resultIndex + 1;
|
|
|
- if (resultCount > resultLen) { // 全部选择完时,输出组合结果
|
|
|
+ // 全部选择完时,输出组合结果
|
|
|
+ if (resultCount > resultLen) {
|
|
|
System.out.println(Arrays.asList(resultList));
|
|
|
return;
|
|
|
}
|