+ 9

[challenge] Decompose into terms

You have a number. Your task: write a program which decompose this number into terms. Example. Input: 4 Output: 1+1+1+1 1+1+2 1+3 4

22nd Jan 2018, 12:50 PM
✴v13✴
✴v13✴ - avatar
12 ответов
22nd Jan 2018, 9:10 PM
LukArToDo
LukArToDo - avatar
+ 13
https://code.sololearn.com/cE4t6IVQpnPs/?ref=app
22nd Jan 2018, 2:12 PM
Louis
Louis - avatar
25th Jan 2018, 1:06 PM
raz
raz - avatar
22nd Jan 2018, 5:58 PM
davy hermans
davy hermans - avatar
+ 4
https://code.sololearn.com/ch3wG3exDxvc/?ref=app
22nd Jan 2018, 10:25 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Challenge accepted
22nd Jan 2018, 2:24 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Gives the number of decompositions without calculating them https://code.sololearn.com/cn11qTHKtT8N/?ref=app
22nd Jan 2018, 3:33 PM
VcC
VcC - avatar
+ 2
How many ones?
22nd Jan 2018, 1:51 PM
Jonas Schröter
Jonas Schröter - avatar
+ 2
for 4 what about 2+2 ? if the challenge is to write i + n-i time 1 this is not a really good one print("\n".join("1"*i+str(n-i)*(i<n) for i in range(n+1))
22nd Jan 2018, 6:42 PM
VcC
VcC - avatar
0
Here is a solution including all solutions including 4=2+2 https://code.sololearn.com/cN0n8eiMAkK9/?ref=app
23rd Jan 2018, 6:34 AM
VcC
VcC - avatar
23rd Jan 2018, 1:36 PM
Alexander Podogov
Alexander Podogov - avatar