// test20.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstring>
#include<string.h>
#include<deque>
using namespace std;
class Solution {
public:
vector<vector<int> > FindContinuousSequence(int sum) {
int half = sum / 2 + 1;
int result = 0;
vector<int> group;
vector<vector<int>> vec;
for (int time = 1;time <= half;++time)
{
for (int num = time;num < sum;++num)
{
group.push_back(num);
result += num;
if (result == sum)
{
vec.push_back(group);
group.clear();
result = 0;
break;
}
else if(result>sum)
{
group.clear();
result = 0;
break;
}
else
{
}
}
}
return vec;
}
};
int main()
{
Solution so;
vector<vector<int>> vec = so.FindContinuousSequence(1);
for (auto it = vec.begin();it != vec.end();++it)
{
for (auto num = it->begin();num != it->end();++num)
{
cout << *num << " ";
}
cout << endl;
}
cout << endl;
return 0;
}