#include
<
cstdio
>
using
namespace
std;
int
N,k;
int
a[
21
];
void
dfs(
int
l,
int
r,
int
w)
{
int
i
=
l;
while
(a[i
-
l]
*
a[r
-
i]
*
w
<
N){
N
=
N
-
(a[i
-
l]
*
a[r
-
i]
*
w);
i
++
;
}
printf(
"
%c
"
,i
+
'
a
'
-
1
);
if
(l
<
i) dfs(l,i
-
1
,w
*
a[r
-
i]);
if
(i
<
r) dfs(i
+
1
,r,w);
}
int
main()
{
freopen(
"
kod.in
"
,
"
r
"
,stdin);
freopen(
"
kod.out
"
,
"
w
"
,stdout);
scanf(
"
%d%d
"
,
&
N,
&
k);
a[
0
]
=
a[
1
]
=
1
;
for
(
int
i
=
2
;i
<
k;
++
i){
a[i]
=
0
;
for
(
int
j
=
0
;j
<
i;
++
j)
a[i]
=
a[i]
+
a[j]
*
a[i
-
1
-
j];
}
dfs(
1
,k,
1
);
printf(
"
\n
"
);
return
0
;
}
posted on 2009-08-01 17:14
xfstart07 阅读(174)
评论(0) 编辑 收藏 引用