A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
13
Task/Man-or-boy-test/Python/man-or-boy-test-1.py
Normal file
13
Task/Man-or-boy-test/Python/man-or-boy-test-1.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
sys.setrecursionlimit(1025)
|
||||
|
||||
def a(in_k, x1, x2, x3, x4, x5):
|
||||
k = [in_k]
|
||||
def b():
|
||||
k[0] -= 1
|
||||
return a(k[0], b, x1, x2, x3, x4)
|
||||
return x4() + x5() if k[0] <= 0 else b()
|
||||
|
||||
x = lambda i: lambda: i
|
||||
print(a(10, x(1), x(-1), x(-1), x(1), x(0)))
|
||||
13
Task/Man-or-boy-test/Python/man-or-boy-test-2.py
Normal file
13
Task/Man-or-boy-test/Python/man-or-boy-test-2.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
sys.setrecursionlimit(1025)
|
||||
|
||||
def a(k, x1, x2, x3, x4, x5):
|
||||
def b():
|
||||
b.k -= 1
|
||||
return a(b.k, b, x1, x2, x3, x4)
|
||||
b.k = k
|
||||
return x4() + x5() if b.k <= 0 else b()
|
||||
|
||||
x = lambda i: lambda: i
|
||||
print(a(10, x(1), x(-1), x(-1), x(1), x(0)))
|
||||
12
Task/Man-or-boy-test/Python/man-or-boy-test-3.py
Normal file
12
Task/Man-or-boy-test/Python/man-or-boy-test-3.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
sys.setrecursionlimit(1025)
|
||||
|
||||
def A(k, x1, x2, x3, x4, x5):
|
||||
def B():
|
||||
nonlocal k
|
||||
k -= 1
|
||||
return A(k, B, x1, x2, x3, x4)
|
||||
return x4() + x5() if k <= 0 else B()
|
||||
|
||||
print(A(10, lambda: 1, lambda: -1, lambda: -1, lambda: 1, lambda: 0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue