You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.6 KiB

#include<bits/stdc++.h>
using namespace std;
vector<string> v1;
int main() {
int a, b, c, d, e, f, g, h, i, j, k, l = 0;
cin >> k;
for (a = 1; a <= 3; a++)
for (b = 1; b <= 3; b++)
for (c = 1; c <= 3; c++)
for (d = 1; d <= 3; d++)
for (e = 1; e <= 3; e++)
for (f = 1; f <= 3; f++)
for (g = 1; g <= 3; g++)
for (h = 1; h <= 3; h++)
for (i = 1; i <= 3; i++)
for (j = 1; j <= 3; j++)
if (a + b + c + d + e + f + g + h + i + j == k)
v1.push_back(to_string(a) + " " +
to_string(b) + " " +
to_string(c) + " " +
to_string(d) + " " +
to_string(e) + " " +
to_string(f) + " " +
to_string(g) + " " +
to_string(h) + " " +
to_string(i) + " " +
to_string(j));
cout << v1.size() << endl;
for (int i = 0; i < v1.size(); i++)
cout << v1[i] << endl;
return 0;
}