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.

50 lines
1.9 KiB

#include<bits/stdc++.h>
using namespace std;
//简化for循环的宏
#define _for(i, a, b) for( int i=(a); i<(b); ++i)
#define _rep(i, a, b) for( int i=(a); i<=(b); ++i)
int main() {
int k, l = 0;
cin >> k;
_rep(a, 1, 3)
_rep(b, 1, 3)
_rep(c, 1, 3)
_rep(d, 1, 3)
_rep(e, 1, 3)
_rep(f, 1, 3)
_rep(g, 1, 3)
_rep(h, 1, 3)
_rep(i, 1, 3)
_rep(j, 1, 3)
if (a + b + c + d + e + f + g + h + i + j == k) l++;
cout << l << endl;
_rep(a, 1, 3)
_rep(b, 1, 3)
_rep(c, 1, 3)
_rep(d, 1, 3)
_rep(e, 1, 3)
_rep(f, 1, 3)
_rep(g, 1, 3)
_rep(h, 1, 3)
_rep(i, 1, 3)
_rep(j, 1, 3)
if (a + b + c + d + e + f + g + h + i + j == k) {
cout << a << " ";
cout << b << " ";
cout << c << " ";
cout << d << " ";
cout << e << " ";
cout << f << " ";
cout << g << " ";
cout << h << " ";
cout << i << " ";
cout << j << endl;
}
return 0;
}