// 165_321.c
#include <stdio.h>
#include <stdlib.h>
void func(char s, char e, int n)
{
char *buff;
int i;
// 各桁ごと
for (; n >= 1; n--) {
// 初期値作成
for (i = 0; i < n; i++) {
buff[i] = s;
}
buff[i] = '\0';
// 計算
while (1) {
i = n - 1;
fprintf(stderr
, "%s\n", buff
); // 出力 buff[i]++;
// 繰り上げ処理
while (1) {
if (buff[i] > e) {
buff[i] = s;
i--;
if (i < 0) {
break;
}
buff[i]++;
}
else {
break;
}
}
if (i < 0) {
break;
}
}
}
}
int main()
{
func('0', '2', 3);
return 0;
}
Ly8gMTY1XzMyMS5jCgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgoKdm9pZCBmdW5jKGNoYXIgcywgY2hhciBlLCBpbnQgbikKewogICAgY2hhciAqYnVmZjsKICAgIGludCBpOwoKICAgIGJ1ZmYgPSBtYWxsb2MobiArIDEpOwogICAgLy8g5ZCE5qGB44GU44GoCiAgICBmb3IgKDsgbiA+PSAxOyBuLS0pIHsKICAgICAgICAvLyDliJ3mnJ/lgKTkvZzmiJAKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgICAgIGJ1ZmZbaV0gPSBzOwogICAgICAgIH0KICAgICAgICBidWZmW2ldID0gJ1wwJzsKICAgICAgICAvLyDoqIjnrpcKICAgICAgICB3aGlsZSAoMSkgewogICAgICAgICAgICBpID0gbiAtIDE7CiAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiJXNcbiIsIGJ1ZmYpOyAvLyDlh7rlipsKICAgICAgICAgICAgYnVmZltpXSsrOwogICAgICAgICAgICAvLyDnubDjgorkuIrjgZLlh6bnkIYKICAgICAgICAgICAgd2hpbGUgKDEpIHsKICAgICAgICAgICAgICAgIGlmIChidWZmW2ldID4gZSkgewogICAgICAgICAgICAgICAgICAgIGJ1ZmZbaV0gPSBzOwogICAgICAgICAgICAgICAgICAgIGktLTsKICAgICAgICAgICAgICAgICAgICBpZiAoaSA8IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGJ1ZmZbaV0rKzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChpIDwgMCkgewogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBmcmVlKGJ1ZmYpOwp9CgppbnQgbWFpbigpCnsKICAgIGZ1bmMoJzAnLCAnMicsIDMpOwoKICAgIHJldHVybiAwOwp9Cg==