Divisibility of numbers

Given a range [l; r] you are asked to print the divisibility for each number in that range (l and r including). For each number, you are asked to print a sequence of + and - signs.
For the number 4, the output should look like ++-+, which means that 4 is divisible by 1 (first +), it is also divisible by 2 (second +), not divisible by 3 (the -), and is divisible by itself (the last +).
The input contains 2 numbers the l and r of that range (l ≤ r).
The output should contain as many rows as there are numbers in that range. Each row should start with the number it refers to, followed by a sequence of + and - signs.
2 6
2 ++ 3 +-+ 4 ++-+ 5 +---+ 6 +++--+


Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue