first commit

This commit is contained in:
heinleinju104093 committed 2026-11-12 11:47:13 +01:00
commit 9615165024
21 files changed
+404

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import time
import functools
from functools import lru_cache
def time_calculation(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
start = time.perf_counter()
result = f(*args, **kwargs)
end = time.perf_counter()
print(f"Dauer: {end-start:.4f} Sekunden")
return result
return wrapper
@lru_cache(maxsize=None)
def coins(n):
if n == 0:
return 1
if n < 0:
return 0
return coins(n-1) + coins(n-2) + coins(n-5)
@time_calculation
def calculate(n):
return coins(n)
calculate(5)
calculate(30)