求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。
1 class Solution { 2 public: 3 int Sum_Solution(int n) { 4 int answer = n; 5 answer && (answer += Sum_Solution(n - 1)); 6 return answer; 7 } 8 };
原文:https://www.cnblogs.com/john1015/p/13096381.html