File tree 1 file changed +14
-13
lines changed
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 1
1
"""
2
2
Counting Summations
3
- Problem 76
3
+ Problem 76: https://projecteuler.net/problem=76
4
4
5
5
It is possible to write five as a sum in exactly six different ways:
6
6
16
16
"""
17
17
18
18
19
- def partition (m ):
20
- """Returns the number of different ways one hundred can be written as a sum
21
- of at least two positive integers.
19
+ def solution (m : int = 100 ) -> int :
20
+ """
21
+ Returns the number of different ways the number m can be written as a
22
+ sum of at least two positive integers.
22
23
23
- >>> partition (100)
24
+ >>> solution (100)
24
25
190569291
25
- >>> partition (50)
26
+ >>> solution (50)
26
27
204225
27
- >>> partition (30)
28
+ >>> solution (30)
28
29
5603
29
- >>> partition (10)
30
+ >>> solution (10)
30
31
41
31
- >>> partition (5)
32
+ >>> solution (5)
32
33
6
33
- >>> partition (3)
34
+ >>> solution (3)
34
35
2
35
- >>> partition (2)
36
+ >>> solution (2)
36
37
1
37
- >>> partition (1)
38
+ >>> solution (1)
38
39
0
39
40
"""
40
41
memo = [[0 for _ in range (m )] for _ in range (m + 1 )]
@@ -51,4 +52,4 @@ def partition(m):
51
52
52
53
53
54
if __name__ == "__main__" :
54
- print (partition (int (str ( input () ).strip ())))
55
+ print (solution (int (input ("Enter a number: " ).strip ())))
You can’t perform that action at this time.
0 commit comments