Add Up Apples

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Python 3 3.0s
Memory limit: 64M

Problem type

Ryuk the shinigami wants to find out the different ways to add up to N apples! For example, if you have 3 apples, the possible ways are:

3=1+1+1
3=1+2
total=2

Ryuk wants you, to output the solution in the above format given the number of apples, N.

Note: The sequence which you output the solution does not matter, meaning:

3=1+1+1
3=1+2

and

3=1+2
3=1+1+1

are both accepted.

Subtasks

Subtask 1 [30%]

1 \le N \le 10

Subtask 2 [70%]

1 \le N \le 50

Input Specifications

You are given an integer N, the number of apples.

Output Specifications

Print out the solution in the above format.

Sample Input

6

Sample Output

6=1+1+1+1+1+1
6=1+1+1+1+2
6=1+1+1+3
6=1+1+2+2
6=1+1+4
6=1+2+3
6=1+5
6=2+2+2
6=2+4
6=3+3
total=10

Comments

There are no comments at the moment.