BNUMBERS - Beautiful Numbers

An integer N is called beautiful if it consists of 1 and/or 2 and/or 3. Given k (1<=k<=5), your task is to generate recursively all possible beautiful integers of length k sorted in increasing order. Output a blank line after each test case.

Example

Input:
1
2 Output:
1
2
3

11
12
13
21
22
23
31
32
33

Added by:Mohamed Ali
Date:2013-04-27
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2015-04-26 00:14:45 _R0b_
3
1
1
2
3

2
1
2
3

11
12
13
21
22
23
31
32
33

3
1
2
3

11
12
13
21
22
23
31
32
33

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333

Why WA ?
2014-10-27 12:59:03 Magaker
please I dont understand what does he want in this problem

Last edit: 2014-10-27 12:59:26
2014-08-18 18:01:58 Mohamed Gouda
damroo : the compiler will not check if your code have a recursive function or not , but you should code it using recursion to practice and be able to understand recursion
2014-08-11 21:02:10 damroo
is it mandatory to do it with recursion ??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.