C++不用'+'实现加法

A+B问题十分清奇的解法

本来用位运算解了,同学来一句-(-a-b),额,AC了

class Solution {
public:
    /*
     * @param : An integer
     * @param : An integer
     * @return: The sum of a and b
     */
    int aplusb(int a, int b) {
        // write your code here
        return (-(-a-b));
    }
};
Written on December 17, 2017