Skip to content

Commit 0edf310

Browse files
committed
divided int
1 parent 1990285 commit 0edf310

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

newcodes/answers/q49.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/bin/env python
2+
# encoding:utf-8
3+
4+
def divided(m,r,out):
5+
if(r==0):
6+
return True
7+
tm=r
8+
while tm>0:
9+
if(tm<=m):
10+
out.append(tm)
11+
if(divided(tm, r-tm, out)):
12+
print(out)
13+
out.pop()
14+
tm = tm-1
15+
return False
16+
17+
18+
n=6
19+
output=[]
20+
divided(n-1, n, output)

0 commit comments

Comments
 (0)