回答編集履歴
1
微修正
answer
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
vector<string> combination;
|
21
21
|
for ( int M = 1; M <= 3; ++M ) {
|
22
22
|
|
23
|
-
//
|
23
|
+
// bits : N-M個のfalse と M個の true
|
24
24
|
array<bool,N> bits;
|
25
25
|
fill(bits.begin(), bits.end(), false);
|
26
26
|
fill(bits.begin()+N-M, bits.end(), true);
|
@@ -40,7 +40,12 @@
|
|
40
40
|
// combination内のpatternそれぞれに対し順列を生成
|
41
41
|
for ( string pattern : combination ) {
|
42
42
|
do {
|
43
|
+
string result;
|
44
|
+
for ( char ch : pattern ) {
|
45
|
+
if ( !result.empty() ) result += ',';
|
46
|
+
result += ch;
|
47
|
+
}
|
43
|
-
cout <<
|
48
|
+
cout << result << endl;
|
44
49
|
} while ( next_permutation(pattern.begin(),pattern.end()) );
|
45
50
|
}
|
46
51
|
}
|