#include #include using namespace std; vector path; void dfs(int rest, int start) { for(int i = start; i <= rest / 2; i++) { path.push_back(i); // 输出当前方案 for(int j = 0; j < path.size(); j++) { cout << path[j] << "+"; } cout << rest - i << endl; // 继续拆 dfs(rest - i, i); path.pop_back(); } } int main() { int n; cin >> n; dfs(n, 1); return 0; }