#include<stdio.h>
#include<string.h>
// 並べ替え結果処理
void kekka_shori(int *d, int len)
{
int i;
for (i = 0; i < len; i++) {
}
}
// len個の配列の右n個を左にスライド
void narabe(int *d, int len, int n)
{
int i, j;
int tmp;
if (n <= 1) {
kekka_shori(d, len);
return;
}
for (j = 0; j < n; j++) {
narabe(d, len, n - 1);
tmp = d[len - n];
for (i = 0; i < n - 1; i++) {
d[len - n + i] = d[len - n + i + 1];
}
d[len - n + i] = tmp;
}
}
int main()
{
int d[] = { 1, 2, 3 };
narabe(d, 3, 3);
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RyaW5nLmg+CgovLyDkuKbjgbnmm7/jgYjntZDmnpzlh6bnkIYKdm9pZCBrZWtrYV9zaG9yaShpbnQgKmQsIGludCBsZW4pCnsKICAgIGludCBpOwoKICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgIHByaW50ZigiJWQiLCBkW2ldKTsKICAgIH0KICAgIHB1dHMoIiIpOwp9CgovLyBsZW7lgIvjga7phY3liJfjga7lj7Nu5YCL44KS5bem44Gr44K544Op44Kk44OJCnZvaWQgbmFyYWJlKGludCAqZCwgaW50IGxlbiwgaW50IG4pCnsKICAgIGludCBpLCBqOwogICAgaW50IHRtcDsKCiAgICBpZiAobiA8PSAxKSB7CiAgICAgICAga2Vra2Ffc2hvcmkoZCwgbGVuKTsKICAgICAgICByZXR1cm47CiAgICB9CiAgICBmb3IgKGogPSAwOyBqIDwgbjsgaisrKSB7CiAgICAgICAgbmFyYWJlKGQsIGxlbiwgbiAtIDEpOwogICAgICAgIHRtcCA9IGRbbGVuIC0gbl07CiAgICAgICAgZm9yIChpID0gMDsgaSA8IG4gLSAxOyBpKyspIHsKICAgICAgICAgICAgZFtsZW4gLSBuICsgaV0gPSBkW2xlbiAtIG4gKyBpICsgMV07CiAgICAgICAgfQogICAgICAgIGRbbGVuIC0gbiArIGldID0gdG1wOwogICAgfQp9CgppbnQgbWFpbigpCnsKICAgIGludCBkW10gPSB7IDEsIDIsIDMgfTsKCiAgICBuYXJhYmUoZCwgMywgMyk7CiAgICByZXR1cm4gMDsKfQ==