求1+2+3+...+n
求1+2+3+...+n
http://www.nowcoder.com/questionTerminal/7a0da8fc483247ff8800059e12d7caf1
public class Solution { public int Sum_Solution(int n) { //方法一短路与 /* int ans = n; boolean flag = (ans>0) && (ans+=Sum_Solution(n-1))>0; return ans;*/ //方法二求数组个数 int m = (int)Math.pow(n, 2)+n; return m>>1; } }