File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""
22Counting Summations
3- Problem 76
3+ Problem 76: https://projecteuler.net/problem=76
44
55It is possible to write five as a sum in exactly six different ways:
66
1616"""
1717
1818
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.
2223
23- >>> partition (100)
24+ >>> solution (100)
2425 190569291
25- >>> partition (50)
26+ >>> solution (50)
2627 204225
27- >>> partition (30)
28+ >>> solution (30)
2829 5603
29- >>> partition (10)
30+ >>> solution (10)
3031 41
31- >>> partition (5)
32+ >>> solution (5)
3233 6
33- >>> partition (3)
34+ >>> solution (3)
3435 2
35- >>> partition (2)
36+ >>> solution (2)
3637 1
37- >>> partition (1)
38+ >>> solution (1)
3839 0
3940 """
4041 memo = [[0 for _ in range (m )] for _ in range (m + 1 )]
@@ -51,4 +52,4 @@ def partition(m):
5152
5253
5354if __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