repl.it
@a_p/

MoneyFax

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import numpy as np

def simulate(l, n):
    s = [1] * n
    for i, j in l:
        s[j] += s[i]
    return sum(s)


sol = np.array([(5, 0), (0, 1), (1, 0), (0, 2), (2, 0), (0, 3), (3, 0), (0, 4), (4, 0), (0, 5), (5, 4), (4, 5), (5, 3), (3, 5), (5, 2), (2, 5), (5, 1), (1, 2), (2, 1), (1, 3), (3, 1), (1, 4), (4, 3), (3, 4), (4, 2), (2, 3), (3, 2), (2, 4), (4, 1), (1, 5)])
swapArr = np.array([29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28])

print(simulate(sol, 6))
for a in range(30):
  sol = sol[swapArr]
  print(simulate(sol, 6))