31 lines
682 B
Python
31 lines
682 B
Python
from collections import deque
|
|
|
|
PRIMES = (23,19,13,17)
|
|
|
|
def mods(x):
|
|
return [x%i for i in PRIMES]
|
|
|
|
M = [
|
|
[
|
|
deque(mods(x) for x in [ 79, 98 ])
|
|
, lambda old: [((o%i)*(19%i))%i for (o,i) in zip(old,PRIMES)]
|
|
, lambda x: 3 if x[0] else 2
|
|
,0
|
|
],[
|
|
deque(mods(x) for x in [ 54, 65, 75, 74 ])
|
|
, lambda old: [((o%i)+(6%i))%i for (o,i) in zip(old,PRIMES)]
|
|
, lambda x: 0 if x[1] else 2
|
|
,0
|
|
],[
|
|
deque(mods(x) for x in [ 79, 60, 97 ])
|
|
, lambda old: [((o%i)*(o%i))%i for (o,i) in zip(old,PRIMES)]
|
|
, lambda x: 3 if x[2] else 1
|
|
,0
|
|
],[
|
|
deque(mods(x) for x in [ 74 ])
|
|
, lambda old: [((o%i)+(3%i))%i for (o,i) in zip(old,PRIMES)]
|
|
, lambda x: 1 if x[3] else 0
|
|
,0
|
|
]
|
|
]
|