Various combinatorial structures


Plus
Pin


Problem description Progress
ID 38215. Prime factorization
Темы: Various combinatorial structures   

The prime factorization of 12 can be written in three ways:

  12=2*2*3=2*3*2=3*2*2

In how many ways can the prime factorization of N be written?

Input
One natural number N is entered (2 <= N <= 1 000 ).

Imprint
Print one number – number of different decomposition entries.

Examples

# Input Output
1 12 3
2 13 1

ID 38624. Generator
Темы: Various combinatorial structures    Placements with repetitions   

Given two positive integers N and K. Print  all strings x1, x2, ..., xN such that xi is natural and 1 ≤ xi ≤ K.

Input
Two natural numbers N and K (N, K ≤ 6) are introduced.

Imprint
Output all required strings in random order – one per line. No string must occur more than once.

Examples
# Input Output
1 2 3 1 1 
1 2 
1 3 
2 1 
2 2 
2 3 
3 1 
3 2 
3 3