编程语言单选难度 3真题改编 · 2024
3479. 实现一个函数,返回整数数组中所有唯一组合。假设数组中元素无重复。
import java.util.*;
public class UniqueCombinations {
public static List<List<Integer>> combine(int[] nums) {
List<List<Integer>> result = new ArrayList<>();
backtrack(result, new ArrayList<>(), nums, 0);
return result;
}
private static void backtrack(List<List<Integer>> result, List<Integer> tempList,
int[] nums, int start) {
result.add(new ArrayList<>(tempList));
for (int i = start; i < nums.length; i++) {
____ // 填空
backtrack(result, tempList, nums, i + 1);
tempList.remove(tempList.size() - 1);
}
}
public static void main(String[] args) {
int[] nums = {1, 2, 3};
List<List<Integer>> combinations = combine(nums);
for (List<Integer> combination : combinations) {
System.out.println(combination);
}
}
}
填空内容是:
练习本题 ›
人工智能单选难度 3真题改编 · 2025
3491. 下面是用keras描述的一个简单的MLP,请问一共需要训练多少个参数?
from keras.models import Sequential
from keras.layers import Dense, Dropout
model = Sequential()
model.add(Dense(32, activation='relu', input_dim=100))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])
model.summary()
练习本题 ›