解题思路
此题考点为高中数学中的等差数列求和,Sn=n(a1+an)/2
故直接return n*(n+1)/2
代码
此题考点为高中数学中的等差数列求和,Sn=n(a1+an)/2
故直接return n*(n+1)/2
上一篇:手写通用数组
下一篇:(吴恩达)4.神经网络学习
1,2,...,n求和的多种方法
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M