第30194题 单选题
当需要计算1到n的所有正整数之和,n的最大取值为10^9时,以下哪种实现方式最优?

已知当n最大可达到10^9时,O(n)时间复杂度的实现会出现运行超时或内存溢出问题,需要选择最优的实现方案。

{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析