class Solution {
public:
    /*
        从1/2开始,向后退,如果恰好都等于sum 推入ret
        如果一旦大于sum 从下一个数开始计算
    */
    vector<vector<int> > FindContinuousSequence(int sum) {
        
        vector<vector<int>>ret;
        if (sum <= 2) {
            return ret;
        }
        int half = (sum + 1) / 2;
        for (int i = 1; i <= half; i++) {
            vector<int>vec;
            int tempSum = i, index = i;
            while(tempSum <= sum && index <= half) {
                tempSum += (++index);
                if (tempSum == sum) {
                    for (int j = i; j <= index; j++) {
                        vec.push_back(j);
                    }
                    ret.push_back(vec);
                }
            }
        }
        return ret;
    }
};