#C5202. Unique Arrays Generation
Unique Arrays Generation
Unique Arrays Generation
Given two integers ( n ) and ( t ), generate all unique arrays of ( n ) non-negative integers that add up to ( t ). Each array should be represented as a concatenated string of its numbers (without any delimiters) and the outputs must be sorted in lexicographical order.
For example, if ( n = 2 ) and ( t = 3 ), the valid arrays are [0, 3], [1, 2], [2, 1], [3, 0]. Their corresponding string representations are "03", "12", "21", and "30" respectively.
inputFormat
The input consists of a single line containing two space-separated integers ( n ) and ( t ), where ( n ) is the number of elements in the array and ( t ) is the target sum.
outputFormat
Print each valid array as a concatenated string on a new line, sorted in lexicographical order. There should be no extra spaces or separators.## sample
2 3
03
12
21
30
</p>