Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
501 B
0
Indexable
Never
from functools import lru_cache

def moves(h):
    return h + 1, h + 2, h + 3

@lru_cache(None)
def f(n):
    if h>=50:
        return 'END'
    elif any(f(x)=='END' for x in moves(h)):
        return 'П1'
    elif all(f(x)=='П1' for x in moves(h)):
            return 'В1'    
    elif any(f(x)=='В1' for x in moves(h)):
        return 'П2'        
    elif all(f(x)=='П2' for x in moves(h)):
            return 'В2'    

for i in range(1, 50):
    h = i
    print(i, f(i))