Recently, when I was playing with a friend's Samsung mobile phone, I suddenly thought of a problem. How much is the possibility of a one-stroke screen lock mode with a nine-point link? At first, I thought it was too easy. 9 !, But it is not that simple, so we should not consider more complex cases (we can not connect all the nine points, that is, the connection of any point that does not overlap is a mode ), you only need to consider all the nine points connected.
At this time, and, these points cannot be directly connected, a total of eight pairs cannot be connected.
Then we thought of removing the policy: 9! Remove the impossible connections.
The formula is as follows: 9! -8 (8! -7 (7! -6 (....)))
Simple programming solution, n = 201600
Small SolutionProgramAs follows (Python ):
# Solve def JC (n) in Python shell if n = 0: return 1; return reduce (lambda X, Y: x * y, range (1, n + 1 )); def ite (n): If n = 0: return 1; return JC (N)-(n-1) * ite (n-1); n = ite (9)
This is just a preliminary idea of my own. I have no standard answer to this question.AlgorithmIf you are interested, you can think about computing. You are welcome to provide different ideas and algorithms ~