class Solution {
public:
vector<vector<int> > FindContinuousSequence(int sum) {
std::vector<int> tmp;
std::vector<std::vector<int>> res;
int left = 1, right = 2;
while (left < right) {
int num = (left + right) * (right - left + 1) / 2;
if (num == sum) {
tmp.clear();
for (int i = left; i <= right; ++i) {
tmp.push_back(i);
}
res.push_back(tmp);
// 以该数字为起点的序列之和已经唯一确定了,进入下一位
++left;
} else if (num > sum) {
++left;
} else {
++right;
}
}
return res;
}
};