// http://i...content-available-to-author-only...e.com/dSiqXY
// 並べ替え
// 重複非表示
#include<stdio.h>
#include<string.h>
char res_d[4 * 3 * 2 * 1][5]; // 結果貯蔵
int res_i; // 結果個数
// 並べ替え結果処理
void kekka_shori(char *p)
{
strcpy(res_d
[res_i
++], p
); // 蓄える }
// 文字列の右n桁を左にスライド
void narabe(char *d, int n)
{
char c;
if (n <= 1) {
kekka_shori(d);
return;
}
for (j = 0; j < n; j++) {
narabe(d, n - 1);
c = d[len - n];
for (i = 0; i < n - 1; i++)
d[len - n + i] = d[len - n + i + 1];
d[len - n + i] = c;
}
}
int main()
{
char d[] = "aabc";
int i, j;
res_i = 0;
for (i = 0; i < res_i; i++) {
for (j = 0; j < i; j++) {
if (0 == strcmp(res_d
[i
], res_d
[j
])) { j = -1; // jを重複発見フラグに使う
break;
}
}
if (j >= 0)
}
return 0;
}
Ly8gaHR0cDovL2kuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmUuY29tL2RTaXFYWQovLyAg5Lim44G55pu/44GICi8vICDph43opIfpnZ7ooajnpLoKCiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPHN0cmluZy5oPgoKY2hhciByZXNfZFs0ICogMyAqIDIgKiAxXVs1XTsgICAvLyDntZDmnpzosq/olLUKaW50IHJlc19pOyAgICAgICAgICAgICAgICAgICAgICAvLyDntZDmnpzlgIvmlbAKCi8vIOS4puOBueabv+OBiOe1kOaenOWHpueQhgp2b2lkIGtla2thX3Nob3JpKGNoYXIgKnApCnsKICAgIHN0cmNweShyZXNfZFtyZXNfaSsrXSwgcCk7ICAvLyDok4TjgYjjgosKfQoKLy8g5paH5a2X5YiX44Gu5Y+zbuahgeOCkuW3puOBq+OCueODqeOCpOODiQp2b2lkIG5hcmFiZShjaGFyICpkLCBpbnQgbikKewogICAgaW50IGksIGosIGxlbiA9IHN0cmxlbihkKTsKICAgIGNoYXIgYzsKCiAgICBpZiAobiA8PSAxKSB7CiAgICAgICAga2Vra2Ffc2hvcmkoZCk7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgZm9yIChqID0gMDsgaiA8IG47IGorKykgewogICAgICAgIG5hcmFiZShkLCBuIC0gMSk7CiAgICAgICAgYyA9IGRbbGVuIC0gbl07CiAgICAgICAgZm9yIChpID0gMDsgaSA8IG4gLSAxOyBpKyspCiAgICAgICAgICAgIGRbbGVuIC0gbiArIGldID0gZFtsZW4gLSBuICsgaSArIDFdOwogICAgICAgIGRbbGVuIC0gbiArIGldID0gYzsKICAgIH0KfQoKaW50IG1haW4oKQp7CiAgICBjaGFyIGRbXSA9ICJhYWJjIjsKICAgIGludCBpLCBqOwoKICAgIHJlc19pID0gMDsKICAgIG5hcmFiZShkLCBzdHJsZW4oZCkpOwogICAgZm9yIChpID0gMDsgaSA8IHJlc19pOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgaTsgaisrKSB7CiAgICAgICAgICAgIGlmICgwID09IHN0cmNtcChyZXNfZFtpXSwgcmVzX2Rbal0pKSB7CiAgICAgICAgICAgICAgICBqID0gLTE7ICAgICAgICAgLy8gauOCkumHjeikh+eZuuimi+ODleODqeOCsOOBq+S9v+OBhgogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGogPj0gMCkKICAgICAgICAgICAgcHJpbnRmKCIlc1xuIiwgcmVzX2RbaV0pOwogICAgfQoKICAgIHJldHVybiAwOwp9