第39106题 单选题
下面的C++代码,用于求一系列数据中的最大值。有关其算法说法错误的是( )。
int find_max(const vector<int>& nums) {
    if (nums.empty()) {
        throw invalid_argument("输入数组不能为空");
    }

    int max_value = nums[0];
    for (int num : nums) {
        if (num > max_value) {
            max_value = num;
        }
    }
    return max_value;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析