提交时间:2023-08-24 21:13:31

运行 ID: 100130

#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<cstdio> #include<vector> using namespace std; int n, s; vector<int>v; void f() { int x{ v[v.size() - 1] }; v.pop_back(); for (int i{ 1 }; i <= x / 2; i++) { v.push_back(i); v.push_back(x - i); printf("%d=", n); for (int i{}; i < v.size(); i++) if (i) printf("+%d", v[i]); else printf("%d", v[i]); printf("\n"); s++; f(); } } int main() { scanf("%d", &n); v.push_back(n); f(); printf("%d", s); return 0; }